Homebrew [Semi-Request] DSLibris Moonshell2

twiztidsinz

Taiju Yamada Fan
OP
Member
Joined
Dec 23, 2008
Messages
4,979
Trophies
0
Website
Visit site
XP
220
Country
United States
I was wondering if anyone has made (doubtful) or could make a version of DSLibris that supports Moonshell2's extlink so you can open ebooks in DSLibris by the file.
All the tools are available, so hopefully it won't be too much work/effort to do.

I would do this myself, but I'm not sure what to do... so if anyone wants to explain what to do, I could give it a shot.


DSLibris Sourceforge Page: http://sourceforge.net/projects/ndslibris/
Source code checkout: http://sourceforge.net/projects/ndslibris/develop
extlink_filestruct.h code:
Code:
#ifndef extlink_filestruct_h
#define extlink_filestruct_h

// extlink.dat structure

typedef u16 UnicodeChar;

#define ExtLinkBody_MaxLength (256)

#define ExtLinkBody_ID (0x30545845) // EXT0

typedef struct {
ÂÂu32 ID,dummy1,dummy2,dummy3; // dummy is ZERO.
ÂÂchar DataFullPathFilenameAlias[ExtLinkBody_MaxLength];
ÂÂchar DataPathAlias[ExtLinkBody_MaxLength];
ÂÂchar DataFilenameAlias[ExtLinkBody_MaxLength];
ÂÂchar NDSFullPathFilenameAlias[ExtLinkBody_MaxLength];
ÂÂchar NDSPathAlias[ExtLinkBody_MaxLength];
ÂÂchar NDSFilenameAlias[ExtLinkBody_MaxLength];
ÂÂUnicodeChar DataFullPathFilenameUnicode[ExtLinkBody_MaxLength];
ÂÂUnicodeChar DataPathUnicode[ExtLinkBody_MaxLength];
ÂÂUnicodeChar DataFilenameUnicode[ExtLinkBody_MaxLength];
ÂÂUnicodeChar NDSFullPathFilenameUnicode[ExtLinkBody_MaxLength];
ÂÂUnicodeChar NDSPathUnicode[ExtLinkBody_MaxLength];
ÂÂUnicodeChar NDSFilenameUnicode[ExtLinkBody_MaxLength];
} TExtLinkBody;


static bool GetFileBody_From_MoonShell2_ExtLink(const char **res_pFullPathFilenameAlias,void **res_pfilebuf,u32 *res_filesize)
{
ÂÂ*res_pFullPathFilenameAlias=NULL;
ÂÂ*res_pfilebuf=NULL;
ÂÂ*res_filesize=0;
ÂÂ
/*
ÂÂconsolePrintf("Start disk driver.\n");
ÂÂif(FAT_InitFiles()==false){
ÂÂÂÂconsolePrintf("DLDI init error.\n");
ÂÂÂÂreturn(false);
ÂÂ}
*/
ÂÂ
ÂÂstatic char FullAlias[ExtLinkBody_MaxLength];
ÂÂ
ÂÂ{
ÂÂÂÂconst char *pfn="/moonshl2/extlink.dat"; // This full path file name is fixation. It is never moved.
ÂÂÂÂ
ÂÂÂÂFILE *pf=FAT_fopen(pfn,"r");
ÂÂÂÂif(pf==NULL){
ÂÂÂÂÂÂconsolePrintf("Extend link data file not found. [%s]\n",pfn);
ÂÂÂÂÂÂreturn(false);
ÂÂÂÂ}
ÂÂÂÂ
ÂÂÂÂu32 ID,IDSize;
ÂÂÂÂIDSize=FAT_fread(&ID,1,4,pf);
ÂÂÂÂ
ÂÂÂÂif((IDSize==0)||(ID==0)){
ÂÂÂÂÂÂconsolePrintf("Please call this application from MoonShell2 by way of the extend link. [%s]\n",pfn);
ÂÂÂÂÂÂFAT_fclose(pf); pf=NULL;
ÂÂÂÂÂÂreturn(false);
ÂÂÂÂ}
ÂÂÂÂif(ExtLinkBody_ID!=ID){
ÂÂÂÂÂÂconsolePrintf("Extend link ID error. (0x%08x!=0x%08x)\n",ExtLinkBody_ID,ID);
ÂÂÂÂÂÂFAT_fclose(pf); pf=NULL;
ÂÂÂÂÂÂreturn(false);
ÂÂÂÂ}
ÂÂÂÂ
ÂÂÂÂu32 Dummy[3];
ÂÂÂÂFAT_fread(Dummy,1,4*3,pf);
ÂÂÂÂ
ÂÂÂÂFAT_fread(FullAlias,1,ExtLinkBody_MaxLength,pf);
ÂÂÂÂ
ÂÂÂÂFAT_fclose(pf); pf=NULL;
ÂÂ}
ÂÂ
ÂÂu8 *pfilebuf=NULL;
ÂÂu32 filesize=0;
ÂÂ
ÂÂ{
ÂÂÂÂconst char *pfn=FullAlias;
ÂÂÂÂ
ÂÂÂÂFILE *pf=FAT_fopen(pfn,"r");
ÂÂÂÂif(pf==NULL){
ÂÂÂÂÂÂconsolePrintf("File not found. [%s]\n",pfn);
ÂÂÂÂÂÂreturn(false);
ÂÂÂÂ}
ÂÂÂÂ
ÂÂÂÂFAT_fseek(pf,0,SEEK_END);
ÂÂÂÂfilesize=FAT_ftell(pf);
ÂÂÂÂFAT_fseek(pf,0,SEEK_SET);
ÂÂÂÂ
ÂÂÂÂpfilebuf=malloc(filesize);
ÂÂÂÂif(pfilebuf==NULL){
ÂÂÂÂÂÂconsolePrintf("Memory overflow. [%s] %dbyte.\n",pfn,filesize);
ÂÂÂÂÂÂFAT_fclose(pf); pf=NULL;
ÂÂÂÂÂÂreturn(false);
ÂÂÂÂ}
ÂÂÂÂ
ÂÂÂÂif(FAT_fread(pfilebuf,1,filesize,pf)!=filesize){
ÂÂÂÂÂÂconsolePrintf("File read error. [%s] %dbyte.\n",pfn,filesize);
ÂÂÂÂÂÂFAT_fclose(pf); pf=NULL;
ÂÂÂÂÂÂreturn(false);
ÂÂÂÂ}
ÂÂÂÂ
ÂÂÂÂFAT_fclose(pf); pf=NULL;
ÂÂ}
ÂÂ
ÂÂ*res_pFullPathFilenameAlias=FullAlias;
ÂÂ*res_pfilebuf=pfilebuf;
ÂÂ*res_filesize=filesize;
ÂÂ
ÂÂreturn(true);
}

#endif
 

twiztidsinz

Taiju Yamada Fan
OP
Member
Joined
Dec 23, 2008
Messages
4,979
Trophies
0
Website
Visit site
XP
220
Country
United States
Anyone?
biggrin.gif


I hate the way DSLibris lists books alphabetically by book title alone, and not by filename, so series are out of order and not grouped.
 

Xenon++

Taiju Yamada
Member
Joined
Dec 17, 2009
Messages
1,394
Trophies
0
Website
Visit site
XP
107
Country
So we have to know how to select book works. Then we can override there with that... possibly quoting yslaunch.
But though I had a look, I could not find it. Possibly because there are two opening method for resuming reading.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    K3Nv2 @ K3Nv2: Lol rappers still promoting crypto