mirror of
https://github.com/echojc/osu-ds.git
synced 2025-06-19 01:15:44 -04:00
Change stuff to make it build
Removed the arm7 section Changed the makefile to only use the arm9 stuff Epicpkmn: Fix source/Graphics/GraphicsManager.cpp Co-Authored-By: Pk11 <epicpkmn11@outlook.com> Co-Authored-By: Kaisaan <34224128+Kaisaan@users.noreply.github.com>
This commit is contained in:
parent
fbbd5c897c
commit
183228e28e
8
.gitignore
vendored
Normal file
8
.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
*.o
|
||||
*.map
|
||||
*.nds
|
||||
*.elf
|
||||
|
||||
.idea
|
||||
cmake-build-debug
|
||||
build
|
34
CMakeLists.txt
Normal file
34
CMakeLists.txt
Normal file
@ -0,0 +1,34 @@
|
||||
# That file is here only to make IDE's happy so they could index all source files.
|
||||
# Real building happens through Makefile.
|
||||
|
||||
cmake_minimum_required(VERSION 3.9)
|
||||
project(osuds)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
|
||||
# Set to your devkitPro's installation dir if environment variable does not exist.
|
||||
set(DEVKITPRO C:/devkitpro)
|
||||
|
||||
include_directories(${DEVKITPRO}/libnds/lib)
|
||||
include_directories(${DEVKITPRO}/libnds/include)
|
||||
include_directories(${DEVKITPRO}/libnds/include/nds)
|
||||
include_directories(${DEVKITPRO}/libnds/include/nds/arm9)
|
||||
include_directories(${DEVKITPRO}/devkitARM)
|
||||
include_directories(${DEVKITPRO}/devkitARM/arm-none-eabi/include)
|
||||
include_directories(arm9/source)
|
||||
include_directories(arm9/fonts)
|
||||
include_directories(arm9/data)
|
||||
include_directories(arm9/build)
|
||||
|
||||
link_directories(${DEVKITPRO}/libnds/lib)
|
||||
link_directories(${DEVKITPRO}/libnds/include)
|
||||
link_directories(${DEVKITPRO}/libnds/include/nds)
|
||||
link_directories(${DEVKITPRO}/libnds/include/nds/arm9)
|
||||
|
||||
add_compile_definitions(ARM9)
|
||||
add_compile_definitions(ARM7)
|
||||
add_compile_definitions(iprintf=printf)
|
||||
|
||||
FILE(GLOB_RECURSE src *.cpp *.hpp *.c *.h)
|
||||
|
||||
add_executable(osuds ${src})
|
148
Makefile
148
Makefile
@ -1,45 +1,149 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
||||
endif
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
export TARGET := $(shell basename $(CURDIR))
|
||||
export TOPDIR := $(CURDIR)
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
# MAXMOD_SOUNDBANK contains a directory of music and sound effect files
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := osuNDS
|
||||
BUILD := build
|
||||
SOURCES := source \
|
||||
source/Libraries \
|
||||
source/System \
|
||||
source/Beatmaps \
|
||||
source/Graphics \
|
||||
source/Helpers \
|
||||
source/GameplayElements \
|
||||
source/HitObjects \
|
||||
source/Rulesets \
|
||||
source/Modes
|
||||
DATA := data/textures \
|
||||
data/sounds
|
||||
INCLUDES := source \
|
||||
include
|
||||
GRAPHICS := gfx
|
||||
FONTS := fonts
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -marm -mthumb-interwork
|
||||
|
||||
CFLAGS := -g -Wall -O2\
|
||||
-march=armv5te -mtune=arm946e-s -fomit-frame-pointer\
|
||||
-ffast-math \
|
||||
$(ARCH)
|
||||
|
||||
CFLAGS += $(INCLUDE) -DARM9
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
||||
|
||||
ASFLAGS := -g $(ARCH) -march=armv5te -mtune=arm946e-s $(INCLUDE)
|
||||
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project (order is important)
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lfat -lnds9
|
||||
|
||||
|
||||
.PHONY: $(TARGET).arm7 $(TARGET).arm9
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(LIBNDS)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
|
||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(FONTS),$(CURDIR)/$(dir))
|
||||
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
FONTFILES := $(foreach dir,$(FONTS),$(notdir $(wildcard $(dir)/*.bmf)))
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CC)
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CXX)
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OFILES := $(addsuffix .o,$(BINFILES)) \
|
||||
$(addsuffix .o,$(FONTFILES)) \
|
||||
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
all: $(TARGET).nds
|
||||
$(OUTPUT).nds : $(OUTPUT).elf
|
||||
$(OUTPUT).elf : $(OFILES)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(TARGET).nds : $(TARGET).arm7 $(TARGET).arm9
|
||||
ndstool -c $(TARGET).nds -7 $(TARGET).arm7 -9 $(TARGET).arm9
|
||||
%.bin.o : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(TARGET).arm7 : arm7/$(TARGET).elf
|
||||
$(TARGET).arm9 : arm9/$(TARGET).elf
|
||||
|
||||
%.bmf.o : %.bmf
|
||||
#---------------------------------------------------------------------------------
|
||||
arm7/$(TARGET).elf:
|
||||
$(MAKE) -C arm7
|
||||
# @echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
arm9/$(TARGET).elf:
|
||||
$(MAKE) -C arm9
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
$(MAKE) -C arm9 clean
|
||||
$(MAKE) -C arm7 clean
|
||||
rm -f $(TARGET).nds $(TARGET).arm7 $(TARGET).arm9
|
||||
-include $(DEPSDIR)/*.d
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
emu:
|
||||
ndstool -c $(TARGET).nds -7 $(TARGET).arm7 -9 $(TARGET).arm9 -d nitro
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
||||
|
132
arm7/Makefile
132
arm7/Makefile
@ -1,132 +0,0 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
||||
endif
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
# DATA is a list of directories containing binary files
|
||||
# all directories are relative to this makefile
|
||||
#---------------------------------------------------------------------------------
|
||||
BUILD := build
|
||||
SOURCES := source
|
||||
INCLUDES := include build
|
||||
DATA :=
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -mthumb-interwork
|
||||
|
||||
CFLAGS := -g -Wall -O2\
|
||||
-mcpu=arm7tdmi -mtune=arm7tdmi -fomit-frame-pointer\
|
||||
-ffast-math \
|
||||
$(ARCH)
|
||||
|
||||
CFLAGS += $(INCLUDE) -DARM7
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -fno-rtti
|
||||
|
||||
|
||||
ASFLAGS := -g $(ARCH)
|
||||
LDFLAGS = -specs=ds_arm7.specs -g $(ARCH) -Wl,-Map,$(notdir $*).map
|
||||
|
||||
LIBS := -ldswifi7 -lnds7
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(LIBNDS)
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export ARM7BIN := $(TOPDIR)/$(TARGET).arm7
|
||||
export ARM7ELF := $(CURDIR)/$(TARGET).arm7.elf
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))
|
||||
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
|
||||
export OFILES := $(addsuffix .o,$(BINFILES)) \
|
||||
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CC)
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CXX)
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) *.elf
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
DEPENDS := $(OFILES:.o=.d)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(ARM7BIN) : $(ARM7ELF)
|
||||
@$(OBJCOPY) -O binary $< $@
|
||||
@echo built ... $(notdir $@)
|
||||
|
||||
|
||||
$(ARM7ELF) : $(OFILES)
|
||||
@echo linking $(notdir $@)
|
||||
@$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# you need a rule like this for each extension you use as binary data
|
||||
#---------------------------------------------------------------------------------
|
||||
%.bin.o : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
@ -1,72 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------
|
||||
|
||||
default ARM7 core
|
||||
|
||||
Copyright (C) 2005
|
||||
Michael Noland (joat)
|
||||
Jason Rogers (dovoto)
|
||||
Dave Murphy (WinterMute)
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
---------------------------------------------------------------------------------*/
|
||||
#include <nds.h>
|
||||
#include <dswifi7.h>
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
void VcountHandler() {
|
||||
//---------------------------------------------------------------------------------
|
||||
inputGetAndSend();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
void VblankHandler(void) {
|
||||
//---------------------------------------------------------------------------------
|
||||
Wifi_Update();
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
int main() {
|
||||
//---------------------------------------------------------------------------------
|
||||
irqInit();
|
||||
fifoInit();
|
||||
|
||||
// read User Settings from firmware
|
||||
readUserSettings();
|
||||
|
||||
// Start the RTC tracking IRQ
|
||||
initClockIRQ();
|
||||
|
||||
SetYtrigger(80);
|
||||
|
||||
installWifiFIFO();
|
||||
installSoundFIFO();
|
||||
|
||||
installSystemFIFO();
|
||||
|
||||
irqSet(IRQ_VCOUNT, VcountHandler);
|
||||
irqSet(IRQ_VBLANK, VblankHandler);
|
||||
|
||||
irqEnable( IRQ_VBLANK | IRQ_VCOUNT | IRQ_NETWORK);
|
||||
|
||||
// Keep the ARM7 mostly idle
|
||||
while (1) swiWaitForVBlank();
|
||||
}
|
||||
|
||||
|
153
arm9/Makefile
153
arm9/Makefile
@ -1,153 +0,0 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
||||
endif
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
# DATA is a list of directories containing binary files
|
||||
# all directories are relative to this makefile
|
||||
#---------------------------------------------------------------------------------
|
||||
BUILD := build
|
||||
SOURCES := source \
|
||||
source/Libraries \
|
||||
source/System \
|
||||
source/Beatmaps \
|
||||
source/Graphics \
|
||||
source/Helpers \
|
||||
source/GameplayElements \
|
||||
source/HitObjects \
|
||||
source/Rulesets \
|
||||
source/Modes
|
||||
INCLUDES := source \
|
||||
include
|
||||
DATA := data/textures \
|
||||
data/sounds
|
||||
FONTS := fonts
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -mthumb -mthumb-interwork
|
||||
|
||||
CFLAGS := -g -Wall -O2\
|
||||
-march=armv5te -mtune=arm946e-s -fomit-frame-pointer\
|
||||
-ffast-math \
|
||||
$(ARCH)
|
||||
|
||||
CFLAGS += $(INCLUDE) -DARM9
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
||||
|
||||
ASFLAGS := -g $(ARCH) -march=armv5te -mtune=arm946e-s
|
||||
|
||||
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lfat -lnds9
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(LIBNDS)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export ARM9BIN := $(TOPDIR)/$(TARGET).arm9
|
||||
export ARM9ELF := $(CURDIR)/$(TARGET).arm9.elf
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(FONTS),$(CURDIR)/$(dir))
|
||||
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
FONTFILES := $(foreach dir,$(FONTS),$(notdir $(wildcard $(dir)/*.bmf)))
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CC)
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CXX)
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OFILES := $(addsuffix .o,$(BINFILES)) \
|
||||
$(addsuffix .o,$(FONTFILES)) \
|
||||
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) *.elf *.nds* *.bin
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(ARM9BIN) : $(ARM9ELF)
|
||||
@$(OBJCOPY) -O binary $< $@
|
||||
@echo built ... $(notdir $@)
|
||||
|
||||
$(ARM9ELF) : $(OFILES)
|
||||
@echo linking $(notdir $@)
|
||||
@$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# you need a rule like this for each extension you use as binary data
|
||||
#---------------------------------------------------------------------------------
|
||||
%.bin.o : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.bmf.o : %.bmf
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
-include $(DEPSDIR)/*.d
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
@ -1,234 +0,0 @@
|
||||
#include "GraphicsManager.h"
|
||||
|
||||
GraphicsManager GraphicsManager::sGraphicsManager;
|
||||
|
||||
GraphicsManager::GraphicsManager()
|
||||
{
|
||||
videoSetMode(MODE_5_3D);
|
||||
videoSetModeSub(MODE_5_2D);
|
||||
|
||||
vramSetBankA(VRAM_A_TEXTURE);
|
||||
vramSetBankC(VRAM_C_SUB_BG);
|
||||
vramSetBankD(VRAM_D_MAIN_BG_0x06000000);
|
||||
vramSetBankE(VRAM_E_TEX_PALETTE);
|
||||
|
||||
REG_BG0CNT = 1;
|
||||
|
||||
glInit();
|
||||
glEnable(GL_BLEND | GL_TEXTURE_2D | GL_ANTIALIAS);
|
||||
|
||||
// setup the rear plane
|
||||
glClearColor(20,20,31,31);
|
||||
glClearPolyID(63);
|
||||
glClearDepth(0x7FFF);
|
||||
|
||||
glViewport(0,0,255,191);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
//gluPerspective(100.3, 4.0/3.0, 0.1, 100); //fovy, aspect(width/height), zNear, zFar
|
||||
glOrtho(0.f, 6.40f, 0.f, 4.80f, 0.1f, 100.f);
|
||||
|
||||
// camera is flipped around a bit - x increases left to right, y increases top to bottom (0,0) to (640,480)
|
||||
gluLookAt( 0, 4.8, -50.0, //camera position
|
||||
0, 4.8, 0.0, //look at
|
||||
0.0, -1.0, 0.0); //up
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
mPolygonId = 0;
|
||||
|
||||
//// LOAD TEXTURES ////
|
||||
|
||||
glGenTextures(NUMBER_OF_TEXTURES, textures);
|
||||
|
||||
int pal0 = gluTexLoadPal(palette0, 4, GL_RGB4);
|
||||
|
||||
LoadGLTexture(TX_PLAY_CIRCLE, GL_RGB4, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal0, uv64x64, circle_bin);
|
||||
LoadGLTexture(TX_PLAY_CIRCLEOVERLAY, GL_RGB4, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal0, uv64x64, circleoverlay_bin);
|
||||
LoadGLTexture(TX_PLAY_CIRCLEAPPROACH, GL_RGB4, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal0, uv64x64, circleapproach_bin);
|
||||
|
||||
LoadGLTexture(TX_PLAY_DISC, GL_RGB4, TEXTURE_SIZE_32, TEXTURE_SIZE_32, pal0, uv32x32, disc_bin);
|
||||
LoadGLTexture(TX_PLAY_SLIDERTICK, GL_RGB4, TEXTURE_SIZE_16, TEXTURE_SIZE_16, pal0, uv16x16, slidertick_bin);
|
||||
LoadGLTexture(TX_PLAY_SLIDERREVERSE, GL_RGB4, TEXTURE_SIZE_32, TEXTURE_SIZE_32, pal0, uv32x32, sliderreverse_bin);
|
||||
|
||||
LoadGLTexture(TX_WHITE, GL_RGB4, TEXTURE_SIZE_8, TEXTURE_SIZE_8, pal0, uv8x8, white_bin);
|
||||
|
||||
int pal1 = gluTexLoadPal(palette1, 16, GL_RGB16);
|
||||
|
||||
LoadGLTexture(TX_PLAY_SPINNER, GL_RGB16, TEXTURE_SIZE_128, TEXTURE_SIZE_128, pal1, uv128x128, spinner_bin);
|
||||
LoadGLTexture(TX_PLAY_SPINNERBARS, GL_RGB16, TEXTURE_SIZE_256, TEXTURE_SIZE_256, pal1, uv256x192, spinnerbars_bin);
|
||||
LoadGLTexture(TX_PLAY_SCOREBAR_BAR, GL_RGB16, TEXTURE_SIZE_256, TEXTURE_SIZE_16, pal1, uv256x16, scorebar_colour_bin);
|
||||
|
||||
int pal2 = gluTexLoadPal(palette2, 16, GL_RGB4);
|
||||
|
||||
LoadGLTexture(TX_PLAY_SPINNERBG, GL_RGB16, TEXTURE_SIZE_256, TEXTURE_SIZE_256, pal2, uv256x192, spinnerbg_bin);
|
||||
|
||||
int pal3 = gluTexLoadPal(palette3, 4, GL_RGB4);
|
||||
|
||||
LoadGLTexture(TX_PLAY_SLIDERB0, GL_RGB4, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal3, uv64x64, sliderb0_bin);
|
||||
LoadGLTexture(TX_PLAY_SLIDERB1, GL_RGB4, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal3, uv64x64, sliderb1_bin);
|
||||
LoadGLTexture(TX_PLAY_SLIDERB2, GL_RGB4, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal3, uv64x64, sliderb2_bin);
|
||||
LoadGLTexture(TX_PLAY_SLIDERB3, GL_RGB4, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal3, uv64x64, sliderb3_bin);
|
||||
LoadGLTexture(TX_PLAY_SLIDERB4, GL_RGB4, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal3, uv64x64, sliderb4_bin);
|
||||
LoadGLTexture(TX_PLAY_SLIDERB5, GL_RGB4, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal3, uv64x64, sliderb5_bin);
|
||||
LoadGLTexture(TX_PLAY_SLIDERB6, GL_RGB4, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal3, uv64x64, sliderb6_bin);
|
||||
LoadGLTexture(TX_PLAY_SLIDERB7, GL_RGB4, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal3, uv64x64, sliderb7_bin);
|
||||
LoadGLTexture(TX_PLAY_SLIDERB8, GL_RGB4, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal3, uv64x64, sliderb8_bin);
|
||||
LoadGLTexture(TX_PLAY_SLIDERB9, GL_RGB4, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal3, uv64x64, sliderb9_bin);
|
||||
LoadGLTexture(TX_PLAY_SLIDERFOLLOW, GL_RGB4, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal3, uv64x64, sliderfollow_bin);
|
||||
|
||||
int pal4 = gluTexLoadPal(palette4, 16, GL_RGB16);
|
||||
|
||||
LoadGLTexture(TX_PLAY_HIT0, GL_RGB16, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal4, uv64x64, hit0_bin);
|
||||
LoadGLTexture(TX_PLAY_HIT300, GL_RGB16, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal4, uv64x64, hit300_bin);
|
||||
LoadGLTexture(TX_PLAY_HIT300K, GL_RGB16, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal4, uv64x64, hit300k_bin);
|
||||
LoadGLTexture(TX_PLAY_HIT300G, GL_RGB16, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal4, uv64x64, hit300g_bin);
|
||||
|
||||
int pal5 = gluTexLoadPal(palette5, 16, GL_RGB16);
|
||||
|
||||
LoadGLTexture(TX_PLAY_HIT50, GL_RGB16, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal5, uv64x64, hit50_bin);
|
||||
LoadGLTexture(TX_PLAY_HIT100, GL_RGB16, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal5, uv64x64, hit100_bin);
|
||||
LoadGLTexture(TX_PLAY_HIT100K, GL_RGB16, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal5, uv64x64, hit100k_bin);
|
||||
|
||||
int pal6 = gluTexLoadPal(palette6, 4, GL_RGB4);
|
||||
|
||||
LoadGLTexture(TX_PLAY_SLIDER30, GL_RGB4, TEXTURE_SIZE_16, TEXTURE_SIZE_16, pal6, uv16x16, slider30_bin);
|
||||
LoadGLTexture(TX_PLAY_SLIDER10, GL_RGB4, TEXTURE_SIZE_16, TEXTURE_SIZE_16, pal6, uv16x16, slider10_bin);
|
||||
|
||||
int pal7 = gluTexLoadPal(palette7, 16, GL_RGB16);
|
||||
|
||||
LoadGLTexture(TX_PLAY_SCOREBAR_KI, GL_RGB16, TEXTURE_SIZE_32, TEXTURE_SIZE_32, pal7, uv32x32, scorebar_ki_bin);
|
||||
LoadGLTexture(TX_PLAY_SCOREBAR_KIDANGER, GL_RGB16, TEXTURE_SIZE_32, TEXTURE_SIZE_32, pal7, uv32x32, scorebar_kidanger_bin);
|
||||
LoadGLTexture(TX_PLAY_SCOREBAR_KIDANGER2, GL_RGB16, TEXTURE_SIZE_32, TEXTURE_SIZE_32, pal7, uv32x32, scorebar_kidanger2_bin);
|
||||
|
||||
int pal8 = gluTexLoadPal(palette8, 16, GL_RGB16);
|
||||
|
||||
LoadGLTexture(TX_PLAY_SCOREBAR, GL_RGB16, TEXTURE_SIZE_256, TEXTURE_SIZE_16, pal8, uv256x16, scorebar_bin);
|
||||
|
||||
// 16 bit textures
|
||||
|
||||
//LoadGLTexture(TX_SONGSELECT_SONGBG, GL_RGB, TEXTURE_SIZE_64, TEXTURE_SIZE_512, -1, NULL, songbg_osu_bin);
|
||||
}
|
||||
|
||||
void GraphicsManager::LoadGLTextureEx(TextureType tex, GL_TEXTURE_TYPE_ENUM type, int sizeX, int sizeY, int palette, const u32* uv, const u8* texture, u32 size)
|
||||
{
|
||||
/* DON'T TOUCH THIS FUNCTION
|
||||
* there seems to be some sort of memory problem somewhere, but it's completely eluding me where it is
|
||||
* the game only loads the textures if this function is the way it is >.>
|
||||
*/
|
||||
|
||||
void* temp = malloc(size);
|
||||
|
||||
glBindTexture(0, textures[tex]);
|
||||
glTexImage2D(0, 0, type, sizeX, sizeY, 0, GL_TEXTURE_COLOR0_TRANSPARENT, (u8*)texture);
|
||||
|
||||
free(temp);
|
||||
|
||||
textureInfo[tex].palette = palette;
|
||||
textureInfo[tex].format = type;
|
||||
textureInfo[tex].uv = uv;
|
||||
}
|
||||
|
||||
void GraphicsManager::Draw(TextureType tex, s32 x, s32 y, u32 width, u32 height, DrawOrigin origin, FieldType fieldtype, rgb color, u32 alpha, s32 angle, float z, const u32* uv)
|
||||
{
|
||||
if (uv == NULL)
|
||||
uv = textureInfo[tex].uv;
|
||||
|
||||
s32 x1 = 270, x2 = 370, y1 = 190, y2 = 290;
|
||||
//float z = zvalue[tex] + deltaz;
|
||||
|
||||
if (fieldtype == FIELD_PLAY)
|
||||
{
|
||||
x += PlayXOffset;
|
||||
y += PlayYOffset;
|
||||
}
|
||||
|
||||
switch (origin)
|
||||
{
|
||||
case ORIGIN_TOPLEFT:
|
||||
x1 = ForceBounds(x);
|
||||
x2 = ForceBounds(x + width);
|
||||
y1 = ForceBounds(y);
|
||||
y2 = ForceBounds(y + height);
|
||||
break;
|
||||
|
||||
case ORIGIN_CENTER:
|
||||
width >>= 1;
|
||||
height >>= 1;
|
||||
|
||||
x1 = ForceBounds(x - width);
|
||||
x2 = ForceBounds(x + width);
|
||||
y1 = ForceBounds(y - height);
|
||||
y2 = ForceBounds(y + height);
|
||||
break;
|
||||
|
||||
case ORIGIN_BOTTOMLEFT:
|
||||
x1 = ForceBounds(x);
|
||||
x2 = ForceBounds(x + width);
|
||||
y1 = ForceBounds(y - height);
|
||||
y2 = ForceBounds(y);
|
||||
break;
|
||||
|
||||
case ORIGIN_TOPRIGHT:
|
||||
x1 = ForceBounds(x - width);
|
||||
x2 = ForceBounds(x);
|
||||
y1 = ForceBounds(y);
|
||||
y2 = ForceBounds(y + height);
|
||||
}
|
||||
|
||||
//need to keep rotating polygonid
|
||||
if (++mPolygonId > 63)
|
||||
mPolygonId = 0;
|
||||
|
||||
//don't draw things out of the screen
|
||||
if (x1 > 640 || x2 < 0 || y1 > 480 || y2 < 0)
|
||||
return;
|
||||
|
||||
glPushMatrix();
|
||||
|
||||
glPolyFmt(POLY_ALPHA(alpha&31) | POLY_ID(mPolygonId) | POLY_CULL_NONE);
|
||||
glColor(color);
|
||||
|
||||
if (angle != 0)
|
||||
{
|
||||
glTranslatef(x/100.0, y/100.0, 0);
|
||||
glRotateZi(angle);
|
||||
glTranslatef(-x/100.0, -y/100.0, 0);
|
||||
}
|
||||
|
||||
glBindTexture(0, textures[tex]);
|
||||
|
||||
if (textureInfo[tex].palette >= 0)
|
||||
glColorTable(textureInfo[tex].format, textureInfo[tex].palette);
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
|
||||
GFX_TEX_COORD = uv[0];
|
||||
glVertex2lu1f(x1, y1, z);
|
||||
|
||||
GFX_TEX_COORD = uv[1];
|
||||
glVertex2lu1f(x2, y1, z);
|
||||
|
||||
GFX_TEX_COORD = uv[2];
|
||||
glVertex2lu1f(x2, y2, z);
|
||||
|
||||
GFX_TEX_COORD = uv[3];
|
||||
glVertex2lu1f(x1, y2, z);
|
||||
|
||||
glEnd();
|
||||
|
||||
glPopMatrix(1);
|
||||
}
|
||||
|
||||
s32 GraphicsManager::ForceBounds(s32 value)
|
||||
{
|
||||
if (value < -200)
|
||||
return -200;
|
||||
|
||||
if (value > 799)
|
||||
return 799;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
||||
<pd><ViewState><e p="osuds\osuds" x="true"></e><e p="osuds\osuds\arm9\source\Libraries" x="true"></e><e p="osuds\osuds\arm9\source\Rulesets" x="true"></e><e p="osuds\osuds\arm7\build" x="false"></e><e p="osuds\osuds\arm9\data" x="false"></e><e p="osuds\osuds\arm9\fonts" x="false"></e><e p="osuds\osuds\arm9" x="true"></e><e p="osuds\osuds\arm9\build" x="false"></e><e p="osuds\osuds\arm9\source" x="true"></e><e p="osuds\osuds\arm9\source\GameplayElements" x="true"></e><e p="osuds\osuds\arm9\source\Graphics" x="true"></e><e p="osuds\osuds\nitro" x="false"></e><e p="osuds" x="true"></e><e p="osuds\osuds\arm7\source" x="true"></e><e p="osuds\osuds\arm9\source\HitObjects" x="true"></e><e p="osuds\osuds\arm9\source\Modes" x="true"></e><e p="osuds\osuds\arm7" x="true"></e><e p="osuds\osuds\arm9\source\Beatmaps" x="true"></e><e p="osuds\osuds\arm9\source\Helpers" x="true"></e><e p="osuds\osuds\arm9\source\System" x="true"></e></ViewState></pd>
|
@ -1 +0,0 @@
|
||||
<Workspace name="New Project Group"><Project path="osuds.pnproj"></Project></Workspace>
|
@ -54,6 +54,7 @@ void Beatmap::Initialize()
|
||||
mCreator = mReader->ReadString();
|
||||
mVersion = mReader->ReadString();
|
||||
mAudioFilename = mReader->ReadString();
|
||||
nocashMessage(mAudioFilename.c_str());
|
||||
|
||||
DifficultyManager::DifficultyHpDrain = mReader->ReadInt8();
|
||||
DifficultyManager::DifficultyCircleSize = mReader->ReadInt8();
|
||||
@ -74,7 +75,10 @@ void Beatmap::Initialize()
|
||||
BeatmapElements::Element().AddTimingPoint(time, beattime, samplesetid);
|
||||
}
|
||||
|
||||
nocashMessage("hio\n");
|
||||
|
||||
u32 breakcount = mReader->ReadVarInt();
|
||||
nocashMessage(std::to_string(breakcount).c_str());
|
||||
for (u32 j=0; j<breakcount; ++j)
|
||||
{
|
||||
s32 starttime = mReader->ReadInt32();
|
||||
@ -83,6 +87,8 @@ void Beatmap::Initialize()
|
||||
BeatmapElements::Element().AddBreakPoint(starttime, endtime);
|
||||
}
|
||||
|
||||
nocashMessage("hio\n");
|
||||
|
||||
iprintf("\x1b[2J");
|
||||
mHitObjectCount = mReader->ReadVarInt();
|
||||
mHitObjectRead = 0;
|
||||
@ -183,6 +189,7 @@ void Beatmap::Buffer(list<HitObject*>& hitObjectList)
|
||||
tPoint->x = (s16)mReader->ReadInt16(); //s32 x
|
||||
tPoint->y = (s16)mReader->ReadInt16(); //s32 y
|
||||
|
||||
|
||||
ticks.push_back(tPoint);
|
||||
}
|
||||
|
@ -47,6 +47,8 @@ void BeatmapManager::BuildCollection()
|
||||
if (length < 4)
|
||||
continue;
|
||||
|
||||
nocashMessage(ext);
|
||||
|
||||
//ext is now the extension of the current file
|
||||
ext += length - 4;
|
||||
|
277
source/Graphics/GraphicsManager.cpp
Normal file
277
source/Graphics/GraphicsManager.cpp
Normal file
@ -0,0 +1,277 @@
|
||||
#include "GraphicsManager.h"
|
||||
#include <string>
|
||||
|
||||
GraphicsManager GraphicsManager::sGraphicsManager;
|
||||
|
||||
int nextPBlock;
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
inline uint32 alignVal( uint32 val, uint32 to ) {
|
||||
return (val & (to-1))? (val & ~(to-1)) + to : val;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
int getNextPaletteSlot(u16 count, uint8 format) {
|
||||
//---------------------------------------------------------------------------------
|
||||
// ensure the result aligns on a palette block for this format
|
||||
uint32 result = alignVal(nextPBlock, 1<<(4-(format==GL_RGB4)));
|
||||
|
||||
// convert count to bytes and align to next (smallest format) palette block
|
||||
count = alignVal( count<<1, 1<<3 );
|
||||
|
||||
// ensure that end is within palette video mem
|
||||
if( result+count > 0x10000 ) // VRAM_F - VRAM_E
|
||||
return -1;
|
||||
|
||||
nextPBlock = result+count;
|
||||
return (int)result;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
void glTexLoadPal(const u16* pal, u16 count, u32 addr) {
|
||||
//---------------------------------------------------------------------------------
|
||||
vramSetBankE(VRAM_E_LCD);
|
||||
swiCopy( pal, &VRAM_E[addr>>1] , count / 2 | COPY_MODE_WORD);
|
||||
vramSetBankE(VRAM_E_TEX_PALETTE);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
int gluTexLoadPal(const u16* pal, u16 count, uint8 format) {
|
||||
//---------------------------------------------------------------------------------
|
||||
int addr = getNextPaletteSlot(count, format);
|
||||
if( addr>=0 )
|
||||
glTexLoadPal(pal, count, (u32) addr);
|
||||
|
||||
return addr;
|
||||
}
|
||||
|
||||
GraphicsManager::GraphicsManager()
|
||||
{
|
||||
videoSetMode(MODE_5_3D);
|
||||
videoSetModeSub(MODE_5_2D);
|
||||
|
||||
vramSetBankA(VRAM_A_TEXTURE);
|
||||
vramSetBankC(VRAM_C_SUB_BG);
|
||||
vramSetBankD(VRAM_D_MAIN_BG_0x06000000);
|
||||
vramSetBankE(VRAM_E_TEX_PALETTE);
|
||||
|
||||
REG_BG0CNT = 1;
|
||||
|
||||
glInit();
|
||||
glEnable(GL_BLEND | GL_TEXTURE_2D | GL_ANTIALIAS);
|
||||
|
||||
// setup the rear plane
|
||||
glClearColor(20,20,31,31);
|
||||
glClearPolyID(63);
|
||||
glClearDepth(0x7FFF);
|
||||
|
||||
glViewport(0,0,255,191);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
//gluPerspective(100.3, 4.0/3.0, 0.1, 100); //fovy, aspect(width/height), zNear, zFar
|
||||
glOrtho(0.f, 6.40f, 0.f, 4.80f, 0.1f, 100.f);
|
||||
|
||||
// camera is flipped around a bit - x increases left to right, y increases top to bottom (0,0) to (640,480)
|
||||
gluLookAt( 0, 4.8, -50.0, //camera position
|
||||
0, 4.8, 0.0, //look at
|
||||
0.0, -1.0, 0.0); //up
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
mPolygonId = 0;
|
||||
|
||||
//// LOAD TEXTURES ////
|
||||
|
||||
glGenTextures(NUMBER_OF_TEXTURES, textures);
|
||||
|
||||
int pal0 = gluTexLoadPal(palette0, 4, GL_RGB4);
|
||||
|
||||
LoadGLTexture(TX_PLAY_CIRCLE, GL_RGB4, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal0, uv64x64, circle_bin);
|
||||
LoadGLTexture(TX_PLAY_CIRCLEOVERLAY, GL_RGB4, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal0, uv64x64, circleoverlay_bin);
|
||||
LoadGLTexture(TX_PLAY_CIRCLEAPPROACH, GL_RGB4, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal0, uv64x64, circleapproach_bin);
|
||||
|
||||
LoadGLTexture(TX_PLAY_DISC, GL_RGB4, TEXTURE_SIZE_32, TEXTURE_SIZE_32, pal0, uv32x32, disc_bin);
|
||||
LoadGLTexture(TX_PLAY_SLIDERTICK, GL_RGB4, TEXTURE_SIZE_16, TEXTURE_SIZE_16, pal0, uv16x16, slidertick_bin);
|
||||
LoadGLTexture(TX_PLAY_SLIDERREVERSE, GL_RGB4, TEXTURE_SIZE_32, TEXTURE_SIZE_32, pal0, uv32x32, sliderreverse_bin);
|
||||
|
||||
LoadGLTexture(TX_WHITE, GL_RGB4, TEXTURE_SIZE_8, TEXTURE_SIZE_8, pal0, uv8x8, white_bin);
|
||||
|
||||
int pal1 = gluTexLoadPal(palette1, 16, GL_RGB16);
|
||||
|
||||
LoadGLTexture(TX_PLAY_SPINNER, GL_RGB16, TEXTURE_SIZE_128, TEXTURE_SIZE_128, pal1, uv128x128, spinner_bin);
|
||||
LoadGLTexture(TX_PLAY_SPINNERBARS, GL_RGB16, TEXTURE_SIZE_256, TEXTURE_SIZE_256, pal1, uv256x192, spinnerbars_bin);
|
||||
LoadGLTexture(TX_PLAY_SCOREBAR_BAR, GL_RGB16, TEXTURE_SIZE_256, TEXTURE_SIZE_16, pal1, uv256x16, scorebar_colour_bin);
|
||||
|
||||
int pal2 = gluTexLoadPal(palette2, 16, GL_RGB4);
|
||||
|
||||
LoadGLTexture(TX_PLAY_SPINNERBG, GL_RGB16, TEXTURE_SIZE_256, TEXTURE_SIZE_256, pal2, uv256x192, spinnerbg_bin);
|
||||
|
||||
int pal3 = gluTexLoadPal(palette3, 4, GL_RGB4);
|
||||
|
||||
LoadGLTexture(TX_PLAY_SLIDERB0, GL_RGB4, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal3, uv64x64, sliderb0_bin);
|
||||
LoadGLTexture(TX_PLAY_SLIDERB1, GL_RGB4, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal3, uv64x64, sliderb1_bin);
|
||||
LoadGLTexture(TX_PLAY_SLIDERB2, GL_RGB4, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal3, uv64x64, sliderb2_bin);
|
||||
LoadGLTexture(TX_PLAY_SLIDERB3, GL_RGB4, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal3, uv64x64, sliderb3_bin);
|
||||
LoadGLTexture(TX_PLAY_SLIDERB4, GL_RGB4, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal3, uv64x64, sliderb4_bin);
|
||||
LoadGLTexture(TX_PLAY_SLIDERB5, GL_RGB4, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal3, uv64x64, sliderb5_bin);
|
||||
LoadGLTexture(TX_PLAY_SLIDERB6, GL_RGB4, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal3, uv64x64, sliderb6_bin);
|
||||
LoadGLTexture(TX_PLAY_SLIDERB7, GL_RGB4, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal3, uv64x64, sliderb7_bin);
|
||||
LoadGLTexture(TX_PLAY_SLIDERB8, GL_RGB4, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal3, uv64x64, sliderb8_bin);
|
||||
LoadGLTexture(TX_PLAY_SLIDERB9, GL_RGB4, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal3, uv64x64, sliderb9_bin);
|
||||
LoadGLTexture(TX_PLAY_SLIDERFOLLOW, GL_RGB4, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal3, uv64x64, sliderfollow_bin);
|
||||
|
||||
int pal4 = gluTexLoadPal(palette4, 16, GL_RGB16);
|
||||
|
||||
LoadGLTexture(TX_PLAY_HIT0, GL_RGB16, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal4, uv64x64, hit0_bin);
|
||||
LoadGLTexture(TX_PLAY_HIT300, GL_RGB16, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal4, uv64x64, hit300_bin);
|
||||
LoadGLTexture(TX_PLAY_HIT300K, GL_RGB16, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal4, uv64x64, hit300k_bin);
|
||||
LoadGLTexture(TX_PLAY_HIT300G, GL_RGB16, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal4, uv64x64, hit300g_bin);
|
||||
|
||||
int pal5 = gluTexLoadPal(palette5, 16, GL_RGB16);
|
||||
|
||||
LoadGLTexture(TX_PLAY_HIT50, GL_RGB16, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal5, uv64x64, hit50_bin);
|
||||
LoadGLTexture(TX_PLAY_HIT100, GL_RGB16, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal5, uv64x64, hit100_bin);
|
||||
LoadGLTexture(TX_PLAY_HIT100K, GL_RGB16, TEXTURE_SIZE_64, TEXTURE_SIZE_64, pal5, uv64x64, hit100k_bin);
|
||||
|
||||
int pal6 = gluTexLoadPal(palette6, 4, GL_RGB4);
|
||||
|
||||
LoadGLTexture(TX_PLAY_SLIDER30, GL_RGB4, TEXTURE_SIZE_16, TEXTURE_SIZE_16, pal6, uv16x16, slider30_bin);
|
||||
LoadGLTexture(TX_PLAY_SLIDER10, GL_RGB4, TEXTURE_SIZE_16, TEXTURE_SIZE_16, pal6, uv16x16, slider10_bin);
|
||||
|
||||
int pal7 = gluTexLoadPal(palette7, 16, GL_RGB16);
|
||||
|
||||
LoadGLTexture(TX_PLAY_SCOREBAR_KI, GL_RGB16, TEXTURE_SIZE_32, TEXTURE_SIZE_32, pal7, uv32x32, scorebar_ki_bin);
|
||||
LoadGLTexture(TX_PLAY_SCOREBAR_KIDANGER, GL_RGB16, TEXTURE_SIZE_32, TEXTURE_SIZE_32, pal7, uv32x32, scorebar_kidanger_bin);
|
||||
LoadGLTexture(TX_PLAY_SCOREBAR_KIDANGER2, GL_RGB16, TEXTURE_SIZE_32, TEXTURE_SIZE_32, pal7, uv32x32, scorebar_kidanger2_bin);
|
||||
|
||||
int pal8 = gluTexLoadPal(palette8, 16, GL_RGB16);
|
||||
|
||||
LoadGLTexture(TX_PLAY_SCOREBAR, GL_RGB16, TEXTURE_SIZE_256, TEXTURE_SIZE_16, pal8, uv256x16, scorebar_bin);
|
||||
|
||||
// 16 bit textures
|
||||
|
||||
//LoadGLTexture(TX_SONGSELECT_SONGBG, GL_RGB, TEXTURE_SIZE_64, TEXTURE_SIZE_512, -1, NULL, songbg_osu_bin);
|
||||
}
|
||||
|
||||
void GraphicsManager::LoadGLTextureEx(TextureType tex, GL_TEXTURE_TYPE_ENUM type, int sizeX, int sizeY, int palette, const u32* uv, const u8* texture, u32 size)
|
||||
{
|
||||
/* DON'T TOUCH THIS FUNCTION
|
||||
* there seems to be some sort of memory problem somewhere, but it's completely eluding me where it is
|
||||
* the game only loads the textures if this function is the way it is >.>
|
||||
*/
|
||||
|
||||
void* temp = malloc(size);
|
||||
|
||||
glBindTexture(0, textures[tex]);
|
||||
glTexImage2D(0, 0, type, sizeX, sizeY, 0, GL_TEXTURE_COLOR0_TRANSPARENT, (u8*)texture);
|
||||
|
||||
free(temp);
|
||||
|
||||
textureInfo[tex].palette = palette;
|
||||
textureInfo[tex].format = type;
|
||||
textureInfo[tex].uv = uv;
|
||||
}
|
||||
|
||||
void GraphicsManager::Draw(TextureType tex, s32 x, s32 y, u32 width, u32 height, DrawOrigin origin, FieldType fieldtype, rgb color, u32 alpha, s32 angle, float z, const u32* uv)
|
||||
{
|
||||
if (uv == NULL)
|
||||
uv = textureInfo[tex].uv;
|
||||
|
||||
s32 x1 = 270, x2 = 370, y1 = 190, y2 = 290;
|
||||
//float z = zvalue[tex] + deltaz;
|
||||
|
||||
if (fieldtype == FIELD_PLAY)
|
||||
{
|
||||
x += PlayXOffset;
|
||||
y += PlayYOffset;
|
||||
}
|
||||
|
||||
switch (origin)
|
||||
{
|
||||
case ORIGIN_TOPLEFT:
|
||||
x1 = ForceBounds(x);
|
||||
x2 = ForceBounds(x + width);
|
||||
y1 = ForceBounds(y);
|
||||
y2 = ForceBounds(y + height);
|
||||
break;
|
||||
|
||||
case ORIGIN_CENTER:
|
||||
width >>= 1;
|
||||
height >>= 1;
|
||||
|
||||
x1 = ForceBounds(x - width);
|
||||
x2 = ForceBounds(x + width);
|
||||
y1 = ForceBounds(y - height);
|
||||
y2 = ForceBounds(y + height);
|
||||
break;
|
||||
|
||||
case ORIGIN_BOTTOMLEFT:
|
||||
x1 = ForceBounds(x);
|
||||
x2 = ForceBounds(x + width);
|
||||
y1 = ForceBounds(y - height);
|
||||
y2 = ForceBounds(y);
|
||||
break;
|
||||
|
||||
case ORIGIN_TOPRIGHT:
|
||||
x1 = ForceBounds(x - width);
|
||||
x2 = ForceBounds(x);
|
||||
y1 = ForceBounds(y);
|
||||
y2 = ForceBounds(y + height);
|
||||
}
|
||||
|
||||
//need to keep rotating polygonid
|
||||
if (++mPolygonId > 63)
|
||||
mPolygonId = 0;
|
||||
|
||||
//don't draw things out of the screen
|
||||
if (x1 > 640 || x2 < 0 || y1 > 480 || y2 < 0)
|
||||
return;
|
||||
|
||||
glPushMatrix();
|
||||
|
||||
glPolyFmt(POLY_ALPHA(alpha&31) | POLY_ID(mPolygonId) | POLY_CULL_NONE);
|
||||
glColor(color);
|
||||
|
||||
if (angle != 0)
|
||||
{
|
||||
glTranslatef(x/100.0, y/100.0, 0);
|
||||
glRotateZi(angle);
|
||||
glTranslatef(-x/100.0, -y/100.0, 0);
|
||||
}
|
||||
|
||||
glBindTexture(0, textures[tex]);
|
||||
|
||||
if (textureInfo[tex].palette >= 0)
|
||||
GFX_PAL_FORMAT = textureInfo[tex].palette >> (4 - (textureInfo[tex].format == GL_RGB4));
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
|
||||
GFX_TEX_COORD = uv[0];
|
||||
glVertex2lu1f(x1, y1, z);
|
||||
|
||||
GFX_TEX_COORD = uv[1];
|
||||
glVertex2lu1f(x2, y1, z);
|
||||
|
||||
GFX_TEX_COORD = uv[2];
|
||||
glVertex2lu1f(x2, y2, z);
|
||||
|
||||
GFX_TEX_COORD = uv[3];
|
||||
glVertex2lu1f(x1, y2, z);
|
||||
|
||||
glEnd();
|
||||
|
||||
glPopMatrix(1);
|
||||
}
|
||||
|
||||
s32 GraphicsManager::ForceBounds(s32 value)
|
||||
{
|
||||
if (value < -200)
|
||||
return -200;
|
||||
|
||||
if (value > 799)
|
||||
return 799;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@
|
||||
using namespace std;
|
||||
|
||||
typedef enum {
|
||||
SND_NORMAL = 0,
|
||||
SND_NORMAL = 1,
|
||||
SND_WHISTLE = 2,
|
||||
SND_FINISH = 4,
|
||||
SND_CLAP = 8
|
@ -110,18 +110,21 @@ float FileReader::ReadFloat() const
|
||||
return *reinterpret_cast<float*>(c);
|
||||
}
|
||||
|
||||
// Read Integers of variable size, kind of like in midi
|
||||
u32 FileReader::ReadVarInt() const
|
||||
{
|
||||
PrepareBuffer(4);
|
||||
u32 value = 0;
|
||||
u8 i = 0;
|
||||
u8 b;
|
||||
do
|
||||
{
|
||||
do // Bits in the file: 10010101 11000101 00100010
|
||||
{ // Bits in the Output: 00000000 0010101 1000101 0100010
|
||||
b = mBuffer[pos++];
|
||||
value += (b & 0x7F) << (7 * i);
|
||||
++i;
|
||||
} while ((b & 0x80) > 0);
|
||||
|
||||
nocashMessage((std::string(" ") + std::to_string(value)).c_str());
|
||||
return value;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user