mirror of
https://github.com/ctruLua/ctruLua.git
synced 2025-10-28 00:39:30 +00:00
Added missing dependicies
This commit is contained in:
parent
03baa21c10
commit
ebcd9f00ed
47 changed files with 18405 additions and 0 deletions
21
libs/sfillib/LICENSE
Normal file
21
libs/sfillib/LICENSE
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Sergi Granell (xerpi), xerpi.g.12@gmail.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
7
libs/sfillib/README.md
Normal file
7
libs/sfillib/README.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
## SFILLIB
|
||||
|
||||
|
||||
Simple and Fast Image Loading library for the Nintendo 3DS (using sf2dlib and ctrulib)
|
||||
|
||||
### Documentation
|
||||
http://xerpi.github.io/sfillib/html/sfil_8h.html
|
||||
2362
libs/sfillib/libsfil/Doxyfile
Normal file
2362
libs/sfillib/libsfil/Doxyfile
Normal file
File diff suppressed because it is too large
Load diff
145
libs/sfillib/libsfil/Makefile
Normal file
145
libs/sfillib/libsfil/Makefile
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
||||
endif
|
||||
|
||||
include $(DEVKITARM)/3ds_rules
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# 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
|
||||
# DATA is a list of directories containing data files
|
||||
# INCLUDES is a list of directories containing header files
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := sfil
|
||||
BUILD := build
|
||||
SOURCES := source
|
||||
DATA := data
|
||||
INCLUDES := include
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard
|
||||
|
||||
CFLAGS := -g -Wall -O2\
|
||||
$(ARCH)
|
||||
|
||||
CFLAGS += $(INCLUDE) -DARM11 -D_3DS
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
||||
|
||||
ASFLAGS := -g $(ARCH)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(CTRULIB) $(PORTLIBS) \
|
||||
$(CURDIR)/../../3ds_portlibs/build \
|
||||
$(CURDIR)/../../sf2dlib/libsf2d
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# 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)/lib/lib$(TARGET).a
|
||||
|
||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(DATA),$(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)/*.*)))
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# 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)) \
|
||||
$(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,$(PORTLIBS),-I$(dir)/include/freetype2) \
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
|
||||
.PHONY: $(BUILD) clean all
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
all: $(BUILD)
|
||||
|
||||
lib:
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
|
||||
$(BUILD): lib
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) lib latex html
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
install: $(BUILD)
|
||||
@cp $(OUTPUT) $(CTRULIB)/lib
|
||||
@cp include/sfil.h $(CTRULIB)/include
|
||||
@echo "Installed!"
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
docs:
|
||||
@doxygen Doxyfile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
DEPENDS := $(OFILES:.o=.d)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT) : $(OFILES)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.bin.o : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
# WARNING: This is not the right way to do this! TODO: Do it right!
|
||||
#---------------------------------------------------------------------------------
|
||||
%_vsh.h %.vsh.o : %.vsh
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@python $(AEMSTRO)/aemstro_as.py $< ../$(notdir $<).shbin
|
||||
@bin2s ../$(notdir $<).shbin | $(PREFIX)as -o $@
|
||||
@echo "extern const u8" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(notdir $<).shbin | tr . _)`.h
|
||||
@echo "extern const u8" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(notdir $<).shbin | tr . _)`.h
|
||||
@echo "extern const u32" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(notdir $<).shbin | tr . _)`.h
|
||||
@rm ../$(notdir $<).shbin
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
||||
71
libs/sfillib/libsfil/include/sfil.h
Normal file
71
libs/sfillib/libsfil/include/sfil.h
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
/**
|
||||
* @file sfil.h
|
||||
* @author Sergi Granell (xerpi)
|
||||
* @date 2 April 2015
|
||||
* @brief sfillib header
|
||||
*/
|
||||
|
||||
#ifndef SFIL_H
|
||||
#define SFIL_H
|
||||
|
||||
#include <3ds.h>
|
||||
#include <sf2d.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Loads a PNG image from the SD card
|
||||
* @param filename the path of the image to load
|
||||
* @param place where to allocate the texture
|
||||
* @return a pointer to the newly created texture/image
|
||||
*/
|
||||
sf2d_texture *sfil_load_PNG_file(const char *filename, sf2d_place place);
|
||||
|
||||
/**
|
||||
* @brief Loads a PNG image from a memory buffer
|
||||
* @param buffer the pointer of the memory buffer to load the image from
|
||||
* @param place where to allocate the texture
|
||||
* @return a pointer to the newly created texture/image
|
||||
*/
|
||||
sf2d_texture *sfil_load_PNG_buffer(const void *buffer, sf2d_place place);
|
||||
|
||||
/**
|
||||
* @brief Loads a JPG/JPEG image from the SD card
|
||||
* @param filename the path of the image to load
|
||||
* @param place where to allocate the texture
|
||||
* @return a pointer to the newly created texture/image
|
||||
*/
|
||||
sf2d_texture *sfil_load_JPEG_file(const char *filename, sf2d_place place);
|
||||
|
||||
/**
|
||||
* @brief Loads a JPG/JPEG image from a memory buffer
|
||||
* @param buffer the pointer of the memory buffer to load the image from
|
||||
* @param buffer_size the size of the memory buffer
|
||||
* @param place where to allocate the texture
|
||||
* @return a pointer to the newly created texture/image
|
||||
*/
|
||||
sf2d_texture *sfil_load_JPEG_buffer(const void *buffer, unsigned long buffer_size, sf2d_place place);
|
||||
|
||||
/**
|
||||
* @brief Loads a BMP image from the SD card
|
||||
* @param filename the path of the image to load
|
||||
* @param place where to allocate the texture
|
||||
* @return a pointer to the newly created texture/image
|
||||
*/
|
||||
sf2d_texture *sfil_load_BMP_file(const char *filename, sf2d_place place);
|
||||
|
||||
/**
|
||||
* @brief Loads a BMP image from a memory buffer
|
||||
* @param buffer the pointer of the memory buffer to load the image from
|
||||
* @param place where to allocate the texture
|
||||
* @return a pointer to the newly created texture/image
|
||||
*/
|
||||
sf2d_texture *sfil_load_BMP_buffer(const void *buffer, sf2d_place place);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
171
libs/sfillib/libsfil/source/sfil_bmp.c
Normal file
171
libs/sfillib/libsfil/source/sfil_bmp.c
Normal file
|
|
@ -0,0 +1,171 @@
|
|||
#include "sfil.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define BMP_SIGNATURE (0x4D42)
|
||||
|
||||
typedef struct {
|
||||
unsigned short bfType;
|
||||
unsigned int bfSize;
|
||||
unsigned short bfReserved1;
|
||||
unsigned short bfReserved2;
|
||||
unsigned int bfOffBits;
|
||||
}__attribute__((packed)) BITMAPFILEHEADER;
|
||||
|
||||
|
||||
typedef struct {
|
||||
unsigned int biSize;
|
||||
unsigned int biWidth;
|
||||
unsigned int biHeight;
|
||||
unsigned short biPlanes;
|
||||
unsigned short biBitCount;
|
||||
unsigned int biCompression;
|
||||
unsigned int biSizeImage;
|
||||
unsigned int biXPelsPerMeter;
|
||||
unsigned int biYPelsPerMeter;
|
||||
unsigned int biClrUsed;
|
||||
unsigned int biClrImportant;
|
||||
}__attribute__((packed)) BITMAPINFOHEADER;
|
||||
|
||||
|
||||
static sf2d_texture *_sfil_load_BMP_generic(
|
||||
BITMAPFILEHEADER *bmp_fh,
|
||||
BITMAPINFOHEADER *bmp_ih,
|
||||
void *user_data,
|
||||
void (*seek_fn)(void *user_data, unsigned int offset),
|
||||
void (*read_fn)(void *user_data, void *buffer, unsigned int length),
|
||||
sf2d_place place)
|
||||
{
|
||||
unsigned int row_size = bmp_ih->biWidth * (bmp_ih->biBitCount/8);
|
||||
if (row_size%4 != 0) {
|
||||
row_size += 4-(row_size%4);
|
||||
}
|
||||
|
||||
sf2d_texture *texture = sf2d_create_texture(bmp_ih->biWidth, bmp_ih->biHeight,
|
||||
GPU_RGBA8, place);
|
||||
|
||||
seek_fn(user_data, bmp_fh->bfOffBits);
|
||||
|
||||
int stride = texture->pow2_w * 4;
|
||||
|
||||
void *buffer = malloc(row_size);
|
||||
unsigned int *tex_ptr;
|
||||
unsigned int color;
|
||||
int i, x, y;
|
||||
|
||||
for (i = 0; i < bmp_ih->biHeight; i++) {
|
||||
|
||||
read_fn(user_data, buffer, row_size);
|
||||
|
||||
y = bmp_ih->biHeight - 1 - i;
|
||||
tex_ptr = (unsigned int *)(texture->data + y*stride);
|
||||
|
||||
for (x = 0; x < bmp_ih->biWidth; x++) {
|
||||
|
||||
if (bmp_ih->biBitCount == 32) { //ABGR8888
|
||||
color = *(unsigned int *)(buffer + x*4);
|
||||
*tex_ptr = (color&0xFF)<<24 | ((color>>8)&0xFF)<<16 |
|
||||
((color>>16)&0xFF)<<8 | (color>>24);
|
||||
|
||||
} else if (bmp_ih->biBitCount == 24) { //BGR888
|
||||
unsigned char *address = buffer + x*3;
|
||||
*tex_ptr = (*address)<<16 | (*(address+1))<<8 |
|
||||
(*(address+2)) | (0xFF<<24);
|
||||
|
||||
} else if (bmp_ih->biBitCount == 16) { //BGR565
|
||||
color = *(unsigned short *)(buffer + x*2);
|
||||
unsigned char r = (color & 0x1F) *((float)255/31);
|
||||
unsigned char g = ((color>>5) & 0x3F) *((float)255/63);
|
||||
unsigned char b = ((color>>11) & 0x1F) *((float)255/31);
|
||||
*tex_ptr = ((r<<16) | (g<<8) | b | (0xFF<<24));
|
||||
}
|
||||
|
||||
tex_ptr++;
|
||||
}
|
||||
}
|
||||
|
||||
free(buffer);
|
||||
|
||||
sf2d_texture_tile32(texture);
|
||||
return texture;
|
||||
}
|
||||
|
||||
static void _sfil_read_bmp_file_seek_fn(void *user_data, unsigned int offset)
|
||||
{
|
||||
fseek((FILE *)user_data, offset, SEEK_SET);
|
||||
}
|
||||
|
||||
static void _sfil_read_bmp_file_read_fn(void *user_data, void *buffer, unsigned int length)
|
||||
{
|
||||
fread(buffer, 1, length, (FILE *)user_data);
|
||||
}
|
||||
|
||||
static void _sfil_read_bmp_buffer_seek_fn(void *user_data, unsigned int offset)
|
||||
{
|
||||
*(unsigned int *)user_data += offset;
|
||||
}
|
||||
|
||||
static void _sfil_read_bmp_buffer_read_fn(void *user_data, void *buffer, unsigned int length)
|
||||
{
|
||||
memcpy(buffer, (void *)*(unsigned int *)user_data, length);
|
||||
*(unsigned int *)user_data += length;
|
||||
}
|
||||
|
||||
sf2d_texture *sfil_load_BMP_file(const char *filename, sf2d_place place)
|
||||
{
|
||||
FILE *fp;
|
||||
if ((fp = fopen(filename, "rb")) == NULL) {
|
||||
goto exit_error;
|
||||
}
|
||||
|
||||
BITMAPFILEHEADER bmp_fh;
|
||||
fread((void *)&bmp_fh, 1, sizeof(BITMAPFILEHEADER), fp);
|
||||
if (bmp_fh.bfType != BMP_SIGNATURE) {
|
||||
goto exit_close;
|
||||
}
|
||||
|
||||
BITMAPINFOHEADER bmp_ih;
|
||||
fread((void *)&bmp_ih, 1, sizeof(BITMAPINFOHEADER), fp);
|
||||
|
||||
sf2d_texture *texture = _sfil_load_BMP_generic(&bmp_fh,
|
||||
&bmp_ih,
|
||||
(void *)&fp,
|
||||
_sfil_read_bmp_file_seek_fn,
|
||||
_sfil_read_bmp_file_read_fn,
|
||||
place);
|
||||
|
||||
fclose(fp);
|
||||
return texture;
|
||||
|
||||
exit_close:
|
||||
fclose(fp);
|
||||
exit_error:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
sf2d_texture *sfil_load_BMP_buffer(const void *buffer, sf2d_place place)
|
||||
{
|
||||
BITMAPFILEHEADER bmp_fh;
|
||||
memcpy(&bmp_fh, buffer, sizeof(BITMAPFILEHEADER));
|
||||
if (bmp_fh.bfType != BMP_SIGNATURE) {
|
||||
goto exit_error;
|
||||
}
|
||||
|
||||
BITMAPINFOHEADER bmp_ih;
|
||||
memcpy(&bmp_ih, buffer + sizeof(BITMAPFILEHEADER), sizeof(BITMAPINFOHEADER));
|
||||
|
||||
unsigned int buffer_address = (unsigned int)buffer;
|
||||
|
||||
sf2d_texture *texture = _sfil_load_BMP_generic(&bmp_fh,
|
||||
&bmp_ih,
|
||||
(void *)&buffer_address,
|
||||
_sfil_read_bmp_buffer_seek_fn,
|
||||
_sfil_read_bmp_buffer_read_fn,
|
||||
place);
|
||||
|
||||
return texture;
|
||||
exit_error:
|
||||
return NULL;
|
||||
}
|
||||
97
libs/sfillib/libsfil/source/sfil_jpeg.c
Normal file
97
libs/sfillib/libsfil/source/sfil_jpeg.c
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
#include "sfil.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <jpeglib.h>
|
||||
|
||||
|
||||
static sf2d_texture *_sfil_load_JPEG_generic(struct jpeg_decompress_struct *jinfo, struct jpeg_error_mgr *jerr, sf2d_place place)
|
||||
{
|
||||
int row_bytes;
|
||||
switch (jinfo->out_color_space) {
|
||||
case JCS_RGB:
|
||||
row_bytes = jinfo->image_width * 3;
|
||||
break;
|
||||
default:
|
||||
goto exit_error;
|
||||
}
|
||||
|
||||
sf2d_texture *texture = sf2d_create_texture(jinfo->image_width,
|
||||
jinfo->image_height,
|
||||
GPU_RGBA8, place);
|
||||
|
||||
JSAMPARRAY buffer = (JSAMPARRAY)malloc(sizeof(JSAMPROW));
|
||||
buffer[0] = (JSAMPROW)malloc(sizeof(JSAMPLE) * row_bytes);
|
||||
|
||||
unsigned int i, color, *tex_ptr;
|
||||
unsigned char *jpeg_ptr;
|
||||
void *row_ptr = texture->data;
|
||||
jpeg_start_decompress(jinfo);
|
||||
|
||||
int stride = texture->pow2_w * 4;
|
||||
|
||||
while (jinfo->output_scanline < jinfo->output_height) {
|
||||
jpeg_read_scanlines(jinfo, buffer, 1);
|
||||
tex_ptr = (row_ptr += stride);
|
||||
for (i = 0, jpeg_ptr = buffer[0]; i < jinfo->output_width; i++) {
|
||||
color = *(jpeg_ptr++);
|
||||
color |= *(jpeg_ptr++)<<8;
|
||||
color |= *(jpeg_ptr++)<<16;
|
||||
*(tex_ptr++) = color | 0xFF000000;
|
||||
}
|
||||
}
|
||||
|
||||
free(buffer[0]);
|
||||
free(buffer);
|
||||
|
||||
sf2d_texture_tile32(texture);
|
||||
return texture;
|
||||
|
||||
exit_error:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
sf2d_texture *sfil_load_JPEG_file(const char *filename, sf2d_place place)
|
||||
{
|
||||
FILE *fp;
|
||||
if ((fp = fopen(filename, "rb")) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct jpeg_decompress_struct jinfo;
|
||||
struct jpeg_error_mgr jerr;
|
||||
|
||||
jinfo.err = jpeg_std_error(&jerr);
|
||||
jpeg_create_decompress(&jinfo);
|
||||
jpeg_stdio_src(&jinfo, fp);
|
||||
jpeg_read_header(&jinfo, 1);
|
||||
|
||||
sf2d_texture *texture = _sfil_load_JPEG_generic(&jinfo, &jerr, place);
|
||||
|
||||
jpeg_finish_decompress(&jinfo);
|
||||
jpeg_destroy_decompress(&jinfo);
|
||||
|
||||
fclose(fp);
|
||||
return texture;
|
||||
}
|
||||
|
||||
|
||||
sf2d_texture *sfil_load_JPEG_buffer(const void *buffer, unsigned long buffer_size, sf2d_place place)
|
||||
{
|
||||
struct jpeg_decompress_struct jinfo;
|
||||
struct jpeg_error_mgr jerr;
|
||||
|
||||
jinfo.err = jpeg_std_error(&jerr);
|
||||
|
||||
jpeg_create_decompress(&jinfo);
|
||||
jpeg_mem_src(&jinfo, (void *)buffer, buffer_size);
|
||||
jpeg_read_header(&jinfo, 1);
|
||||
|
||||
sf2d_texture *texture = _sfil_load_JPEG_generic(&jinfo, &jerr, place);
|
||||
|
||||
jpeg_finish_decompress(&jinfo);
|
||||
jpeg_destroy_decompress(&jinfo);
|
||||
|
||||
return texture;
|
||||
}
|
||||
139
libs/sfillib/libsfil/source/sfil_png.c
Normal file
139
libs/sfillib/libsfil/source/sfil_png.c
Normal file
|
|
@ -0,0 +1,139 @@
|
|||
#include "sfil.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <png.h>
|
||||
|
||||
#define PNG_SIGSIZE (8)
|
||||
|
||||
static void _sfil_read_png_file_fn(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
{
|
||||
FILE *fp = (FILE *)png_get_io_ptr(png_ptr);
|
||||
fread(data, 1, length, fp);
|
||||
}
|
||||
|
||||
static void _sfil_read_png_buffer_fn(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
{
|
||||
unsigned int *address = png_get_io_ptr(png_ptr);
|
||||
memcpy(data, (void *)*address, length);
|
||||
*address += length;
|
||||
}
|
||||
|
||||
static sf2d_texture *_sfil_load_PNG_generic(const void *io_ptr, png_rw_ptr read_data_fn, sf2d_place place)
|
||||
{
|
||||
png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||
if (png_ptr == NULL) {
|
||||
goto exit_error;
|
||||
}
|
||||
|
||||
png_infop info_ptr = png_create_info_struct(png_ptr);
|
||||
if (info_ptr == NULL) {
|
||||
goto exit_destroy_read;
|
||||
}
|
||||
|
||||
png_bytep *row_ptrs = NULL;
|
||||
|
||||
if (setjmp(png_jmpbuf(png_ptr))) {
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)0);
|
||||
if (row_ptrs != NULL)
|
||||
free(row_ptrs);
|
||||
goto exit_error;
|
||||
}
|
||||
|
||||
png_set_read_fn(png_ptr, (png_voidp)io_ptr, read_data_fn);
|
||||
png_set_sig_bytes(png_ptr, PNG_SIGSIZE);
|
||||
png_read_info(png_ptr, info_ptr);
|
||||
|
||||
unsigned int width, height;
|
||||
int bit_depth, color_type;
|
||||
|
||||
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth,
|
||||
&color_type, NULL, NULL, NULL);
|
||||
|
||||
if ((color_type == PNG_COLOR_TYPE_PALETTE && bit_depth <= 8)
|
||||
|| (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
|
||||
|| png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)
|
||||
|| (bit_depth == 16)) {
|
||||
png_set_expand(png_ptr);
|
||||
}
|
||||
|
||||
if (bit_depth == 8 && color_type == PNG_COLOR_TYPE_RGB)
|
||||
png_set_filler(png_ptr, 0xFF, PNG_FILLER_AFTER);
|
||||
|
||||
if (color_type == PNG_COLOR_TYPE_PALETTE) {
|
||||
png_set_palette_to_rgb(png_ptr);
|
||||
png_set_filler(png_ptr, 0xFF, PNG_FILLER_AFTER);
|
||||
}
|
||||
|
||||
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
|
||||
png_set_expand_gray_1_2_4_to_8(png_ptr);
|
||||
|
||||
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
|
||||
png_set_tRNS_to_alpha(png_ptr);
|
||||
|
||||
if (bit_depth < 8)
|
||||
png_set_packing(png_ptr);
|
||||
|
||||
png_read_update_info(png_ptr, info_ptr);
|
||||
|
||||
row_ptrs = (png_bytep *)malloc(sizeof(png_bytep) * height);
|
||||
sf2d_texture *texture = sf2d_create_texture(width, height, GPU_RGBA8, place);
|
||||
|
||||
int stride = texture->pow2_w * 4;
|
||||
int i;
|
||||
for (i = 0; i < height; i++) {
|
||||
row_ptrs[i] = (png_bytep)(texture->data + i*stride);
|
||||
}
|
||||
|
||||
png_read_image(png_ptr, row_ptrs);
|
||||
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)0);
|
||||
free(row_ptrs);
|
||||
|
||||
sf2d_texture_tile32(texture);
|
||||
return texture;
|
||||
|
||||
exit_destroy_read:
|
||||
png_destroy_read_struct(&png_ptr, (png_infopp)0, (png_infopp)0);
|
||||
exit_error:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
sf2d_texture *sfil_load_PNG_file(const char *filename, sf2d_place place)
|
||||
{
|
||||
png_byte pngsig[PNG_SIGSIZE];
|
||||
FILE *fp;
|
||||
|
||||
if ((fp = fopen(filename, "rb")) == NULL) {
|
||||
goto exit_error;
|
||||
}
|
||||
|
||||
if (fread(pngsig, 1, PNG_SIGSIZE, fp) != PNG_SIGSIZE) {
|
||||
goto exit_close;
|
||||
}
|
||||
|
||||
if (png_sig_cmp(pngsig, 0, PNG_SIGSIZE) != 0) {
|
||||
goto exit_close;
|
||||
}
|
||||
|
||||
sf2d_texture *texture = _sfil_load_PNG_generic((void *)fp, _sfil_read_png_file_fn, place);
|
||||
fclose(fp);
|
||||
return texture;
|
||||
|
||||
exit_close:
|
||||
fclose(fp);
|
||||
exit_error:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sf2d_texture *sfil_load_PNG_buffer(const void *buffer, sf2d_place place)
|
||||
{
|
||||
if (png_sig_cmp((png_byte *) buffer, 0, PNG_SIGSIZE) != 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
unsigned int buffer_address = (unsigned int)buffer + PNG_SIGSIZE;
|
||||
|
||||
return _sfil_load_PNG_generic((void *)&buffer_address, _sfil_read_png_buffer_fn, place);
|
||||
}
|
||||
207
libs/sfillib/sample/Makefile
Normal file
207
libs/sfillib/sample/Makefile
Normal file
|
|
@ -0,0 +1,207 @@
|
|||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
||||
endif
|
||||
|
||||
TOPDIR ?= $(CURDIR)
|
||||
include $(DEVKITARM)/3ds_rules
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# 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
|
||||
# DATA is a list of directories containing data files
|
||||
# INCLUDES is a list of directories containing header files
|
||||
#
|
||||
# NO_SMDH: if set to anything, no SMDH file is generated.
|
||||
# APP_TITLE is the name of the app stored in the SMDH file (Optional)
|
||||
# APP_DESCRIPTION is the description of the app stored in the SMDH file (Optional)
|
||||
# APP_AUTHOR is the author of the app stored in the SMDH file (Optional)
|
||||
# ICON is the filename of the icon (.png), relative to the project folder.
|
||||
# If not set, it attempts to use one of the following (in this order):
|
||||
# - <Project name>.png
|
||||
# - icon.png
|
||||
# - <libctru folder>/default_icon.png
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := sfil_sample
|
||||
BUILD := build
|
||||
SOURCES := source
|
||||
DATA := data
|
||||
INCLUDES := include
|
||||
|
||||
APP_TITLE := SFILLIB sample
|
||||
APP_DESCRIPTION := SFILLIB sample
|
||||
APP_AUTHOR := xerpi
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard
|
||||
|
||||
CFLAGS := -g -Wall -O2 -mword-relocations \
|
||||
-fomit-frame-pointer -ffast-math \
|
||||
$(ARCH)
|
||||
|
||||
CFLAGS += $(INCLUDE) -DARM11 -D_3DS
|
||||
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
|
||||
|
||||
ASFLAGS := -g $(ARCH)
|
||||
LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
LIBS := -lsfil -lpng -ljpeg -lz -lsf2d -lctru -lm
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(CTRULIB) $(PORTLIBS)
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# 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 TOPDIR := $(CURDIR)
|
||||
|
||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(DATA),$(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)/*.*)))
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# 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)) \
|
||||
$(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)
|
||||
|
||||
ifeq ($(strip $(ICON)),)
|
||||
icons := $(wildcard *.png)
|
||||
ifneq (,$(findstring $(TARGET).png,$(icons)))
|
||||
export APP_ICON := $(TOPDIR)/$(TARGET).png
|
||||
else
|
||||
ifneq (,$(findstring icon.png,$(icons)))
|
||||
export APP_ICON := $(TOPDIR)/icon.png
|
||||
endif
|
||||
endif
|
||||
else
|
||||
export APP_ICON := $(TOPDIR)/$(ICON)
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(NO_SMDH)),)
|
||||
export _3DSXFLAGS += --smdh=$(CURDIR)/$(TARGET).smdh
|
||||
endif
|
||||
|
||||
.PHONY: $(BUILD) clean all
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
all: $(BUILD)
|
||||
|
||||
$(BUILD):
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(TARGET).3dsx $(OUTPUT).smdh $(TARGET).elf $(TARGET)-strip.elf $(TARGET).cia $(TARGET).3ds
|
||||
#---------------------------------------------------------------------------------
|
||||
$(TARGET)-strip.elf: $(BUILD)
|
||||
@$(STRIP) $(TARGET).elf -o $(TARGET)-strip.elf
|
||||
#---------------------------------------------------------------------------------
|
||||
cci: $(TARGET)-strip.elf
|
||||
@makerom -f cci -rsf resources/$(TARGET).rsf -target d -exefslogo -elf $(TARGET)-strip.elf -o $(TARGET).3ds
|
||||
@echo "built ... sfil_sample.3ds"
|
||||
#---------------------------------------------------------------------------------
|
||||
cia: $(TARGET)-strip.elf
|
||||
@makerom -f cia -o $(TARGET).cia -elf $(TARGET)-strip.elf -rsf resources/$(TARGET).rsf -exefslogo -target t
|
||||
@echo "built ... sfil_sample.cia"
|
||||
#---------------------------------------------------------------------------------
|
||||
send: $(BUILD)
|
||||
@3dslink $(TARGET).3dsx
|
||||
#---------------------------------------------------------------------------------
|
||||
run: $(BUILD)
|
||||
@citra $(TARGET).3dsx
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
DEPENDS := $(OFILES:.o=.d)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(NO_SMDH)),)
|
||||
$(OUTPUT).3dsx : $(OUTPUT).elf $(OUTPUT).smdh
|
||||
else
|
||||
$(OUTPUT).3dsx : $(OUTPUT).elf
|
||||
endif
|
||||
|
||||
$(OUTPUT).elf : $(OFILES)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# you need a rule like this for each extension you use as binary data
|
||||
#---------------------------------------------------------------------------------
|
||||
%.bin.o : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.jpeg.o: %.jpeg
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.png.o : %.png
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
# WARNING: This is not the right way to do this! TODO: Do it right!
|
||||
#---------------------------------------------------------------------------------
|
||||
%.vsh.o : %.vsh
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@python $(AEMSTRO)/aemstro_as.py $< ../$(notdir $<).shbin
|
||||
@bin2s ../$(notdir $<).shbin | $(PREFIX)as -o $@
|
||||
@echo "extern const u8" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(notdir $<).shbin | tr . _)`.h
|
||||
@echo "extern const u8" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(notdir $<).shbin | tr . _)`.h
|
||||
@echo "extern const u32" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(notdir $<).shbin | tr . _)`.h
|
||||
@rm ../$(notdir $<).shbin
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
||||
BIN
libs/sfillib/sample/data/3dbrew.png
Normal file
BIN
libs/sfillib/sample/data/3dbrew.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
BIN
libs/sfillib/sample/data/citra.jpeg
Normal file
BIN
libs/sfillib/sample/data/citra.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.6 KiB |
236
libs/sfillib/sample/resources/sfil_sample.rsf
Normal file
236
libs/sfillib/sample/resources/sfil_sample.rsf
Normal file
|
|
@ -0,0 +1,236 @@
|
|||
BasicInfo:
|
||||
Title : "SFILLIB sample"
|
||||
CompanyCode : "00"
|
||||
ProductCode : "sfil-sample"
|
||||
ContentType : Application # Application / SystemUpdate / Manual / Child / Trial
|
||||
Logo : Nintendo # Nintendo / Licensed / Distributed / iQue / iQueForSystem
|
||||
|
||||
#Rom:
|
||||
# Specifies the root path of the file system to include in the ROM.
|
||||
# HostRoot : "$(ROMFS_ROOT)"
|
||||
|
||||
|
||||
TitleInfo:
|
||||
UniqueId : 0xf0030 # This was/is the first real homebrew app. I hope this TID range is not used by any retail game/app.
|
||||
Category : Application # Application / SystemApplication / Applet / Firmware / Base / DlpChild / Demo / Contents / SystemContents / SharedContents / AddOnContents / Patch / AutoUpdateContents
|
||||
|
||||
CardInfo:
|
||||
MediaSize : 512MB # 128MB / 256MB / 512MB / 1GB / 2GB / 4GB / 8GB / 16GB / 32GB
|
||||
MediaType : Card1 # Card1 / Card2
|
||||
CardDevice : NorFlash # NorFlash(Pick this if you use savedata) / None
|
||||
|
||||
|
||||
Option:
|
||||
UseOnSD : true # true if App is to be installed to SD
|
||||
EnableCompress : true # Compresses exefs code
|
||||
FreeProductCode : true # Removes limitations on ProductCode
|
||||
EnableCrypt : false # Enables encryption for NCCH and CIA
|
||||
MediaFootPadding : false # If true CCI files are created with padding
|
||||
|
||||
ExeFs: # these are the program segments from the ELF, check your elf for the appropriate segment names
|
||||
ReadOnly:
|
||||
- .rodata
|
||||
- RO
|
||||
ReadWrite:
|
||||
- .data
|
||||
- RO
|
||||
Text:
|
||||
- .init
|
||||
- .text
|
||||
- STUP_ENTRY
|
||||
|
||||
PlainRegion: # only used with SDK ELFs
|
||||
# - .module_id
|
||||
|
||||
AccessControlInfo:
|
||||
# UseOtherVariationSaveData : true
|
||||
# UseExtSaveData : true
|
||||
# ExtSaveDataId: 0xffffffff
|
||||
# SystemSaveDataId1: 0x220
|
||||
# SystemSaveDataId2: 0x00040010
|
||||
# OtherUserSaveDataId1: 0x220
|
||||
# OtherUserSaveDataId2: 0x330
|
||||
# OtherUserSaveDataId3: 0x440
|
||||
# UseExtendedSaveDataAccessControl: true
|
||||
# AccessibleSaveDataIds: [0x101, 0x202, 0x303, 0x404, 0x505, 0x606]
|
||||
FileSystemAccess:
|
||||
# - CategorySystemApplication
|
||||
# - CategoryHardwareCheck
|
||||
# - CategoryFileSystemTool
|
||||
- Debug
|
||||
# - TwlCardBackup
|
||||
# - TwlNandData
|
||||
# - Boss
|
||||
- DirectSdmc
|
||||
# - Core
|
||||
# - CtrNandRo
|
||||
# - CtrNandRw
|
||||
# - CtrNandRoWrite
|
||||
# - CategorySystemSettings
|
||||
# - CardBoard
|
||||
# - ExportImportIvs
|
||||
# - DirectSdmcWrite
|
||||
# - SwitchCleanup
|
||||
# - SaveDataMove
|
||||
# - Shop
|
||||
# - Shell
|
||||
# - CategoryHomeMenu
|
||||
IoAccessControl:
|
||||
# - FsMountNand
|
||||
# - FsMountNandRoWrite
|
||||
# - FsMountTwln
|
||||
# - FsMountWnand
|
||||
# - FsMountCardSpi
|
||||
# - UseSdif3
|
||||
# - CreateSeed
|
||||
# - UseCardSpi
|
||||
|
||||
IdealProcessor : 0
|
||||
AffinityMask : 1
|
||||
|
||||
Priority : 16
|
||||
|
||||
MaxCpu : 0x9E # Default
|
||||
|
||||
DisableDebug : true
|
||||
EnableForceDebug : false
|
||||
CanWriteSharedPage : true
|
||||
CanUsePrivilegedPriority : false
|
||||
CanUseNonAlphabetAndNumber : true
|
||||
PermitMainFunctionArgument : true
|
||||
CanShareDeviceMemory : true
|
||||
RunnableOnSleep : false
|
||||
SpecialMemoryArrange : true
|
||||
|
||||
CoreVersion : 2
|
||||
DescVersion : 2
|
||||
|
||||
ReleaseKernelMajor : "02"
|
||||
ReleaseKernelMinor : "33"
|
||||
MemoryType : Application # Application / System / Base
|
||||
HandleTableSize: 512
|
||||
IORegisterMapping:
|
||||
- 1ff50000-1ff57fff
|
||||
- 1ff70000-1ff77fff
|
||||
MemoryMapping:
|
||||
- 1f000000-1f5fffff:r
|
||||
SystemCallAccess:
|
||||
ArbitrateAddress: 34
|
||||
Break: 60
|
||||
CancelTimer: 28
|
||||
ClearEvent: 25
|
||||
ClearTimer: 29
|
||||
CloseHandle: 35
|
||||
ConnectToPort: 45
|
||||
ControlMemory: 1
|
||||
CreateAddressArbiter: 33
|
||||
CreateEvent: 23
|
||||
CreateMemoryBlock: 30
|
||||
CreateMutex: 19
|
||||
CreateSemaphore: 21
|
||||
CreateThread: 8
|
||||
CreateTimer: 26
|
||||
DuplicateHandle: 39
|
||||
ExitProcess: 3
|
||||
ExitThread: 9
|
||||
GetCurrentProcessorNumber: 17
|
||||
GetHandleInfo: 41
|
||||
GetProcessId: 53
|
||||
GetProcessIdOfThread: 54
|
||||
GetProcessIdealProcessor: 6
|
||||
GetProcessInfo: 43
|
||||
GetResourceLimit: 56
|
||||
GetResourceLimitCurrentValues: 58
|
||||
GetResourceLimitLimitValues: 57
|
||||
GetSystemInfo: 42
|
||||
GetSystemTick: 40
|
||||
GetThreadContext: 59
|
||||
GetThreadId: 55
|
||||
GetThreadIdealProcessor: 15
|
||||
GetThreadInfo: 44
|
||||
GetThreadPriority: 11
|
||||
MapMemoryBlock: 31
|
||||
OutputDebugString: 61
|
||||
QueryMemory: 2
|
||||
ReleaseMutex: 20
|
||||
ReleaseSemaphore: 22
|
||||
SendSyncRequest1: 46
|
||||
SendSyncRequest2: 47
|
||||
SendSyncRequest3: 48
|
||||
SendSyncRequest4: 49
|
||||
SendSyncRequest: 50
|
||||
SetThreadPriority: 12
|
||||
SetTimer: 27
|
||||
SignalEvent: 24
|
||||
SleepThread: 10
|
||||
UnmapMemoryBlock: 32
|
||||
WaitSynchronization1: 36
|
||||
WaitSynchronizationN: 37
|
||||
InterruptNumbers:
|
||||
ServiceAccessControl:
|
||||
- APT:U
|
||||
- $hioFIO
|
||||
- $hostio0
|
||||
- $hostio1
|
||||
- ac:u
|
||||
- boss:U
|
||||
- cam:u
|
||||
- cecd:u
|
||||
- cfg:u
|
||||
- dlp:FKCL
|
||||
- dlp:SRVR
|
||||
- dsp::DSP
|
||||
- frd:u
|
||||
- fs:USER
|
||||
- gsp::Gpu
|
||||
- hid:USER
|
||||
- http:C
|
||||
- mic:u
|
||||
- ndm:u
|
||||
- news:u
|
||||
- nwm::UDS
|
||||
- ptm:u
|
||||
- pxi:dev
|
||||
- soc:U
|
||||
- ssl:C
|
||||
- y2r:u
|
||||
- ldr:ro
|
||||
- ir:USER
|
||||
|
||||
|
||||
SystemControlInfo:
|
||||
SaveDataSize: 0KB # It doesn't use any save data.
|
||||
RemasterVersion: 2
|
||||
StackSize: 0x40000
|
||||
# JumpId: 0
|
||||
Dependency:
|
||||
ac: 0x0004013000002402L
|
||||
am: 0x0004013000001502L
|
||||
boss: 0x0004013000003402L
|
||||
camera: 0x0004013000001602L
|
||||
cecd: 0x0004013000002602L
|
||||
cfg: 0x0004013000001702L
|
||||
codec: 0x0004013000001802L
|
||||
csnd: 0x0004013000002702L
|
||||
dlp: 0x0004013000002802L
|
||||
dsp: 0x0004013000001a02L
|
||||
friends: 0x0004013000003202L
|
||||
gpio: 0x0004013000001b02L
|
||||
gsp: 0x0004013000001c02L
|
||||
hid: 0x0004013000001d02L
|
||||
http: 0x0004013000002902L
|
||||
i2c: 0x0004013000001e02L
|
||||
ir: 0x0004013000003302L
|
||||
mcu: 0x0004013000001f02L
|
||||
mic: 0x0004013000002002L
|
||||
ndm: 0x0004013000002b02L
|
||||
news: 0x0004013000003502L
|
||||
nim: 0x0004013000002c02L
|
||||
nwm: 0x0004013000002d02L
|
||||
pdn: 0x0004013000002102L
|
||||
ps: 0x0004013000003102L
|
||||
ptm: 0x0004013000002202L
|
||||
ro: 0x0004013000003702L
|
||||
socket: 0x0004013000002e02L
|
||||
spi: 0x0004013000002302L
|
||||
ssl: 0x0004013000002f02L
|
||||
45
libs/sfillib/sample/source/main.c
Normal file
45
libs/sfillib/sample/source/main.c
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
#include <3ds.h>
|
||||
#include <sf2d.h>
|
||||
#include <sfil.h>
|
||||
|
||||
#include "citra_jpeg.h"
|
||||
#include "3dbrew_png.h"
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
sf2d_init();
|
||||
sf2d_set_clear_color(RGBA8(0x40, 0x40, 0x40, 0xFF));
|
||||
|
||||
sf2d_texture *tex1 = sfil_load_JPEG_buffer(citra_jpeg, citra_jpeg_size, SF2D_PLACE_RAM);
|
||||
sf2d_texture *tex2 = sfil_load_PNG_buffer(_3dbrew_png, SF2D_PLACE_RAM);
|
||||
|
||||
while (aptMainLoop()) {
|
||||
|
||||
hidScanInput();
|
||||
|
||||
if (hidKeysHeld() & KEY_START) {
|
||||
break;
|
||||
}
|
||||
|
||||
sf2d_start_frame(GFX_TOP, GFX_LEFT);
|
||||
|
||||
sf2d_draw_texture(tex1, 400/2 - tex1->width/2, 240/2 - tex1->height/2);
|
||||
|
||||
sf2d_end_frame();
|
||||
|
||||
sf2d_start_frame(GFX_BOTTOM, GFX_LEFT);
|
||||
|
||||
sf2d_draw_texture(tex2, 320/2 - tex2->width/2, 240/2 - tex2->height/2);
|
||||
|
||||
sf2d_end_frame();
|
||||
|
||||
sf2d_swapbuffers();
|
||||
}
|
||||
|
||||
sf2d_free_texture(tex1);
|
||||
sf2d_free_texture(tex2);
|
||||
|
||||
sf2d_fini();
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue