Skip to content

Commit

Permalink
refactor: redo installer to clean up code & make it simpler
Browse files Browse the repository at this point in the history
  • Loading branch information
DacoTaco committed Dec 23, 2024
1 parent fc9cea2 commit 2de7903
Show file tree
Hide file tree
Showing 6 changed files with 1,288 additions and 1,731 deletions.
42 changes: 42 additions & 0 deletions src/Installer/include/installer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
Preloader/Priiloader Installer - An installation utiltiy for preloader (c) 2008-2020 crediar
Copyright (c) 2020 DacoTaco
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

#pragma once

#ifndef ALIGN32
#define ALIGN32(x) (((x) + 31) & ~31)
#endif

#include <gctypes.h>

enum InstallerAction {
None = 0,
Install = 1,
Update = 2,
Remove = 3,
};

void InitializeInstaller(u64 titleId, bool isvWii);
bool PriiloaderInstalled(void);
void DeletePriiloaderFiles(InstallerAction action);
s32 RemovePriiloader(void);
s32 WritePriiloader(InstallerAction action);
s32 CopyTicket(void);
s32 PatchTMD(InstallerAction action);
46 changes: 46 additions & 0 deletions src/Installer/include/nand.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
Preloader/Priiloader Installer - An installation utiltiy for preloader (c) 2008-2020 crediar
Copyright (c) 2024 DacoTaco
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

#pragma once

#include <gctypes.h>
#include <string>

enum NandActionErrors
{
InvalidArgument = -80,
MemoryAllocation = -81,
HashCalculation = -82,
HashComparison = -83,
RenameFailure = -84,
};

typedef struct
{
u32 owner;
u16 group;
u8 attributes;
u8 ownerperm;
u8 groupperm;
u8 otherperm;
} NandPermissions;

s32 NandWrite(const std::string destination, const void* data, u32 dataSize, NandPermissions destPermissions);
s32 NandCopy(const std::string source, const std::string destination, NandPermissions srcPermissions);
24 changes: 24 additions & 0 deletions src/Installer/include/title.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
Preloader/Priiloader Installer - An installation utiltiy for preloader (c) 2008-2020 crediar
Copyright (c) 2020 DacoTaco
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

#pragma once

#define TITLE_UPPER(x) (u32)(x >> 32)
#define TITLE_LOWER(x) (u32)(x & 0xFFFFFFFF)
Loading

0 comments on commit 2de7903

Please sign in to comment.