mirror of
https://github.com/LNH-team/pico-launcher.git
synced 2026-06-02 09:06:54 +02:00
Initial commit
This commit is contained in:
35
arm9/source/gui/DescendingStackVramManager.h
Normal file
35
arm9/source/gui/DescendingStackVramManager.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
#include "StackVramManager.h"
|
||||
|
||||
/// @brief Stack vram manager that decreases the stack pointer before an allocation.
|
||||
class DescendingStackVramManager : public StackVramManager
|
||||
{
|
||||
public:
|
||||
/// @brief Creates a new DescendingStackVramManager.
|
||||
/// @param vramSize The size of the vram block to manage.
|
||||
/// This will be used as the initial offset.
|
||||
explicit DescendingStackVramManager(u32 vramSize)
|
||||
: _size(vramSize)
|
||||
{
|
||||
_offset = vramSize;
|
||||
}
|
||||
|
||||
/// @brief Creates a new DescendingStackVramManager.
|
||||
/// @param vramAddress Pointer to the start of the vram block to manage.
|
||||
/// @param vramSize The size of the vram block to manage.
|
||||
/// This will be used as the initial offset.
|
||||
DescendingStackVramManager(vu16* vramAddress, u32 vramSize)
|
||||
: StackVramManager(vramAddress), _size(vramSize)
|
||||
{
|
||||
_offset = vramSize;
|
||||
}
|
||||
|
||||
u32 Alloc(u32 length) override
|
||||
{
|
||||
_offset -= length;
|
||||
return _offset;
|
||||
}
|
||||
|
||||
private:
|
||||
u32 _size;
|
||||
};
|
||||
Reference in New Issue
Block a user