dev: clean docs and everything, add TODOs

This commit is contained in:
Zy 2024-10-11 20:22:15 +02:00
parent 8fdc653722
commit 898162121d
20 changed files with 74 additions and 127 deletions

View file

@ -1,21 +1 @@
MIT License TODO being compatible with licenses from: 3ds-template, minilibx, xpm and devkitpro
Copyright (c) 2017 [Brandon W.]
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

View file

@ -1,3 +1,7 @@
# From (where?) (<-- TODO answer)
# Modified by Zy to work with the MinilibX For 3DS project
# (at https://github.com/frzysk/mlx3ds).
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
.SUFFIXES: .SUFFIXES:
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------

View file

@ -1,69 +1 @@
# 3ds-template TODO README.md
A starter template for various 3DS homebrew applications. This template is geared specifically towards the Code::Blocks IDE. This template can also be used without Code::Blocks just use the `Makefile` and directory structure provided.
This is designed to be a simple and fairly minimal setup required to begin developing homebrew for the 3ds system. As such it doesn't include everything needed to build everything out of the box if you want to build 3ds or cia homebrew.
## Usage
| Targets | Action |
| ------------| ----------------------------------------------------------------------------------------- |
| 3ds | Builds `<project name>.3ds`. <sup>1</sup>
| 3dsx | Builds `<project name>.3dsx` and `<project name>.smdh`.
| cia | Builds `<project name>.cia`. <sup>1</sup>
| citra | Builds and automatically runs `citra` for testing.<sup>2</sup>
| elf | Builds `<project name>.elf`.
| release | Release build, creates a `cia`, `3ds`, and a zip file containing the `smdh` and `3dsx`. <sup>3</sup>
**Notes:**
* <sup>1</sup> This requires having [makerom] and [bannertool] in your `$PATH`
* <sup>2</sup> `make citra` requires having [citra] installed and in your `$PATH`
* <sup>3</sup> If you are on Windows you will need both of the following in your `$PATH` [zip] and [libbz2.dll]
## Setting up devkitPro
* Follow the steps installing devkitPro at the gbatemp [wiki]
### If you want to build cia and 3ds then follow these extra steps:
* Aquire makerom and bannertool binaries from [buildtools], or compile them yourself from [makerom] and [bannertool]
* Copy the makerom/bannertool to `$DEVKITARM/bin` or some other directory in your `$PATH`
## Code::Blocks Setup
1. Simply open `3ds.cbp` in Code::Blocks
2. Choose File > Save as user-template and enter a template name. The project setup is now a user template to create new projects.
3. When creating a new project select File > New > From template and follow the wizard's instructions.
4. Ensure you have the environment variables plugin installed (in linux you can install this by installing the codeblocks-contrib package)
5. Choose Settings > Environment and scroll down to the Environment Variables section.
6. Add `DEVKITPRO` and point it to where devkitpro is installed
7. Add `DEVKITARM` and point it to where devkitarm is.
To compile in Code::Blocks simply select your target from the list and click the Gear icon to automatically invoke the `Makefile`
**Note** Make sure you are using MSYS2's make (make.exe) and not MINGW's make (mingw32-make.exe)
## Creating a new project
1. Make a new Code::Blocks project via a user-template you just created above. Or simply copy this directory.
2. (Only needed for cia/3ds builds) Edit the file `resources/AppInfo`
1. Edit those values and ensure you choose a unique id see [unique_id_list].
2. Replace the existing files in the `resources` directory to suit your needs.
**Note** please ensure that no folder/directory used in the project contains spaces. Devkitpro's Makefiles apparently does not like this.
That is, do not have it in a folder like `C:/3DS Hacking/3ds-template` rather `C:/3DS_Hacking/3ds-template`
## Credits
All of this would not have been possible without the work of
* [Smealum](https://github.com/smealum)
* [Steveice10](https://github.com/Steveice10) for the [buildtools]
* [amaredeus](https://github.com/amaredeus) for various improvements to the template (such as the formatting in this README)
[//]: # (These are reference links used in the body of this note and get stripped out when the markdown processor does its job. There is no need to format nicely because it shouldn't be seen. Thanks SO - http://stackoverflow.com/questions/4823468/store-comments-in-markdown-syntax)
[buildtools]: <https://github.com/Steveice10/buildtools>
[bannertool]: <https://github.com/Steveice10/buildtools>
[citra]: <https://github.com/citra-emu/citra>
[libbz2.dll]: <http://downloads.sourceforge.net/gnuwin32/zip-3.0-dep.zip>
[makerom]: <https://github.com/profi200/Project_CTR>
[unique_id_list]: <https://gbatemp.net/threads/homebrew-cias-uniqueid-collection.379362>
[wiki]: <https://wiki.gbatemp.net/wiki/3DS_Homebrew_Development#Install_devkitARM>
[zip]: <http://downloads.sourceforge.net/gnuwin32/zip-3.0-bin.zip>

View file

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
# USED BY MAKEFILE, DO NOT MOVE OR RENAME # USED BY MAKEFILE, DO NOT MOVE OR RENAME
# TODO embedassets.sh: docs
ASSETS_FULL_DIR=$1 ASSETS_FULL_DIR=$1
shift shift

View file

@ -17,9 +17,6 @@
* doesn't do anything. The returned values marked as "unused" are undefined. * doesn't do anything. The returned values marked as "unused" are undefined.
* Both are kept as is to stay as compatible as possible with project using the * Both are kept as is to stay as compatible as possible with project using the
* original MinilibX implementation. * original MinilibX implementation.
*
* When using a x,y couple to define a position, the origin (0,0) is always at
* the top-left corner of the image.
*/ */
/** /**

View file

@ -6,7 +6,8 @@
*/ */
/** /**
* Functions to use the assets embedded with the program with embedassets.sh * This file contains functions to use the assets embedded with the program
* with embedassets.sh.
*/ */
#ifndef MLX3DS_ASSETS_H #ifndef MLX3DS_ASSETS_H

View file

@ -6,9 +6,10 @@
*/ */
/** /**
* Define different type aliases for the different void* values used with * This file contains different typedefs for void*, to differenciate between
* the mlx_ functions. * the different void* used by the MLX functions.
*/ */
#ifndef MLX3DS_TYPEALIASES_H #ifndef MLX3DS_TYPEALIASES_H
# define MLX3DS_TYPEALIASES_H # define MLX3DS_TYPEALIASES_H
@ -21,4 +22,4 @@ typedef void *t_win;
/// @brief Reference to an image in memory. /// @brief Reference to an image in memory.
typedef void *t_image; typedef void *t_image;
#endif #endif

View file

@ -20,7 +20,7 @@
*/ */
/** /**
* Functions to manage window events. * This file contains the functions used to manage window events.
*/ */
#ifndef MLX_HOOK_H #ifndef MLX_HOOK_H
@ -43,7 +43,6 @@ int _mlx_mouse_hook(t_win win_ptr, int (*funct_ptr)(), void *param);
/// @param funct_ptr Function to call when the event occurs. `keycode` is the /// @param funct_ptr Function to call when the event occurs. `keycode` is the
/// key pressed (note that they are obviously different than /// key pressed (note that they are obviously different than
/// the keyboard ones, use the KEY_* constants from hid.h)). /// the keyboard ones, use the KEY_* constants from hid.h)).
/// (TODO what was the name of the key constants use with mlx?)
/// `param` is set as the address given to mlx_key_hook(). /// `param` is set as the address given to mlx_key_hook().
/// The return value is unused. /// The return value is unused.
/// @param param Address to pass to the function every time it is called. /// @param param Address to pass to the function every time it is called.

View file

@ -17,13 +17,14 @@
* doesn't do anything. The returned values marked as "unused" are undefined. * doesn't do anything. The returned values marked as "unused" are undefined.
* Both are kept as is to stay as compatible as possible with project using the * Both are kept as is to stay as compatible as possible with project using the
* original MinilibX implementation. * original MinilibX implementation.
*
* When using a x,y couple to define a position, the origin (0,0) is always at
* the top-left corner of the image.
*/ */
/** /**
* Functions to import, create, modify and display images. * This file contains functions to import, create, modify and display images.
*
* When using a x,y couple to define a position, the origin (0,0) is always at
* the top-left corner of the image (despite how the 3ds screen works, for those
* who know).
*/ */
#ifndef MLX_IMAGE_H #ifndef MLX_IMAGE_H
@ -67,17 +68,17 @@ char *mlx_get_data_addr(t_image img_ptr, int *bits_per_pixel,
int mlx_put_image_to_window(t_mlx mlx_ptr, t_win win_ptr, t_image img_ptr, int mlx_put_image_to_window(t_mlx mlx_ptr, t_win win_ptr, t_image img_ptr,
int x, int y); int x, int y);
// ??? TODO docs // ??? TODO docs xpm_to_image
// width & height CAN be null (check please :3) // width & height CAN be null (check please :3)
t_image mlx_xpm_to_image(t_mlx mlx_ptr, const char **xpm_data, t_image mlx_xpm_to_image(t_mlx mlx_ptr, const char **xpm_data,
int *width, int *height); int *width, int *height);
// ??? // ??? TODO docs xpm_file_to_image
// width & height CAN be null (check please :3) // width & height CAN be null (check please :3)
t_image _mlx_xpm_file_to_image(t_mlx mlx_ptr, char *filename, t_image _mlx_xpm_file_to_image(t_mlx mlx_ptr, char *filename,
int *width, int *height); int *width, int *height);
/// @brief Destroy an image. /// @brief Destroy an image to avoid leaks.
/// ///
/// @param mlx_ptr mlx connection identifier returned by mlx_init(). /// @param mlx_ptr mlx connection identifier returned by mlx_init().
/// @param img_ptr Image to destroy. /// @param img_ptr Image to destroy.

View file

@ -17,9 +17,6 @@
* doesn't do anything. The returned values marked as "unused" are undefined. * doesn't do anything. The returned values marked as "unused" are undefined.
* Both are kept as is to stay as compatible as possible with project using the * Both are kept as is to stay as compatible as possible with project using the
* original MinilibX implementation. * original MinilibX implementation.
*
* When using a x,y couple to define a position, the origin (0,0) is always at
* the top-left corner of the image.
*/ */
/** /**

View file

@ -17,15 +17,16 @@
* doesn't do anything. The returned values marked as "unused" are undefined. * doesn't do anything. The returned values marked as "unused" are undefined.
* Both are kept as is to stay as compatible as possible with project using the * Both are kept as is to stay as compatible as possible with project using the
* original MinilibX implementation. * original MinilibX implementation.
*
* When using a x,y couple to define a position, the origin (0,0) is always at
* the top-left corner of the image.
*/ */
/** /**
* Functions to draw specific things on the window. * All the functions to draw specific things on the window.
* *
* Note that mlx_put_image_to_window() is in mlx_image.h * When using a x,y couple to define a position, the origin (0,0) is always at
* the top-left corner of the image (despite how the 3ds screen works, for those
* who know).
*
* (The function mlx_put_image_to_window() is declared in mlx_image.h)
*/ */
#ifndef MLX_PUT_H #ifndef MLX_PUT_H
@ -34,8 +35,11 @@
# include "mlx3ds_typealiases.h" # include "mlx3ds_typealiases.h"
/// @brief Draws a pixel on the window. /// @brief Draws a pixel on the window.
/// @details Way slower than even the original MinilibX.
/// Bad function. Those who use it are condemned to have unexplicable
/// segfaults in exams.
/// ///
/// @param mlx_ptr mlx connection identifier returned by mlx_init(). /// @param mlx_ptr mlx connectio n identifier returned by mlx_init().
/// @param win_ptr Window to affect. /// @param win_ptr Window to affect.
/// @param x x position of the pixel to set. /// @param x x position of the pixel to set.
/// @param y y position of the pixel to set. /// @param y y position of the pixel to set.
@ -54,7 +58,7 @@ int mlx_pixel_put(t_mlx mlx_ptr, t_win win_ptr, int x, int y, int color);
int _mlx_string_put(void *mlx_ptr, void *win_ptr, int x, int y, int color, int _mlx_string_put(void *mlx_ptr, void *win_ptr, int x, int y, int color,
char *string); char *string);
// ??? // TODO docs set_font
void _mlx_set_font(void *mlx_ptr, void *win_ptr, char *name); void _mlx_set_font(void *mlx_ptr, void *win_ptr, char *name);
#endif #endif

View file

@ -17,9 +17,6 @@
* doesn't do anything. The returned values marked as "unused" are undefined. * doesn't do anything. The returned values marked as "unused" are undefined.
* Both are kept as is to stay as compatible as possible with project using the * Both are kept as is to stay as compatible as possible with project using the
* original MinilibX implementation. * original MinilibX implementation.
*
* When using a x,y couple to define a position, the origin (0,0) is always at
* the top-left corner of the image.
*/ */
/** /**
@ -66,4 +63,4 @@ int _mlx_do_key_autorepeatoff(t_mlx mlx_ptr);
// ??? // ???
int _mlx_do_key_autorepeaton(t_mlx mlx_ptr); int _mlx_do_key_autorepeaton(t_mlx mlx_ptr);
#endif #endif

View file

@ -17,13 +17,10 @@
* doesn't do anything. The returned values marked as "unused" are undefined. * doesn't do anything. The returned values marked as "unused" are undefined.
* Both are kept as is to stay as compatible as possible with project using the * Both are kept as is to stay as compatible as possible with project using the
* original MinilibX implementation. * original MinilibX implementation.
*
* When using a x,y couple to define a position, the origin (0,0) is always at
* the top-left corner of the image.
*/ */
/** /**
* Functions to manage windows. * This file contains functions to manage windows.
*/ */
#ifndef MLX_WINDOW_H #ifndef MLX_WINDOW_H

View file

@ -5,6 +5,14 @@
* at https://github.com/frzysk/mlx3ds * at https://github.com/frzysk/mlx3ds
*/ */
/**
* This file contains some internal functions that have to be inline for
* optimization purposes.
*
* Yes, I do include this file directly even if it's a .c file.
* What the norminette doesn't know can't hurt it.
*/
#include "3ds.h" #include "3ds.h"
/// @brief Write a color at a specific location of the memory, /// @brief Write a color at a specific location of the memory,

View file

@ -8,12 +8,17 @@
** Last update Wed May 25 16:44:16 2011 Olivier Crouzet ** Last update Wed May 25 16:44:16 2011 Olivier Crouzet
*/ */
/* /*
** Internal settings for MiniLibX ** Internal settings for MiniLibX
*/ */
/**
* Modified by Zy to work with the MinilibX For 3DS project
* (at https://github.com/frzysk/mlx3ds).
*/
// TODO: from mlx xpm: clean
#ifndef MLX_INT_H #ifndef MLX_INT_H
# define MLX_INT_H # define MLX_INT_H

View file

@ -8,6 +8,13 @@
** Last update Fri Dec 14 11:02:09 2001 Charlie Root ** Last update Fri Dec 14 11:02:09 2001 Charlie Root
*/ */
/**
* Modified by Zy to work with the MinilibX For 3DS project
* (at https://github.com/frzysk/mlx3ds).
*/
// TODO: from mlx xpm: clean
#include "mlx_int.h" #include "mlx_int.h"
// [USED] [FULL] // [USED] [FULL]

View file

@ -5,6 +5,8 @@
* at https://github.com/frzysk/mlx3ds * at https://github.com/frzysk/mlx3ds
*/ */
// TODO mlx_internal.cpp: embed uc_pause() and change to .c file
#include "utilsconsole.hpp" #include "utilsconsole.hpp"
extern "C" { extern "C" {

View file

@ -6,7 +6,7 @@
*/ */
/** /**
* Internal utils of the mlx3ds. * This file contains internal utils.
*/ */
#ifndef MLX_INTERNAL_H #ifndef MLX_INTERNAL_H

View file

@ -3,6 +3,13 @@
** the XFree86 distribution. ** the XFree86 distribution.
*/ */
/**
* Modified by Zy to work with the MinilibX For 3DS project
* (at https://github.com/frzysk/mlx3ds).
*/
// TODO: from mlx xpm: clean
#include "mlx_int.h" #include "mlx_int.h"
struct s_col_name mlx_col_name[] = struct s_col_name mlx_col_name[] =

View file

@ -8,6 +8,13 @@
** Last update Sat Oct 1 14:56:13 2005 Olivier Crouzet ** Last update Sat Oct 1 14:56:13 2005 Olivier Crouzet
*/ */
/**
* Modified by Zy to work with the MinilibX For 3DS project
* (at https://github.com/frzysk/mlx3ds).
*/
// TODO: from mlx xpm: clean
#include "mlx_int.h" #include "mlx_int.h"
#include "mlx.h" #include "mlx.h"
#include "mlx_internal.h" #include "mlx_internal.h"