mirror of
https://github.com/reswitched/Mephisto.git
synced 2024-05-23 06:37:19 -04:00
Update SwIPC submodule
This also add enum and versioning support. Please note that actual SwIPC master doesn't have parameters for LaunchProcess (in pm:shel)
This commit is contained in:
parent
2ae322bd9d
commit
ed9905785f
19
Ctu.h
19
Ctu.h
|
@ -221,4 +221,23 @@ private:
|
||||||
unordered_map<ghandle, shared_ptr<KObject>> handles;
|
unordered_map<ghandle, shared_ptr<KObject>> handles;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO: move this/autogenerate this
|
||||||
|
#define VERSION_1_0_0 0
|
||||||
|
#define VERSION_2_0_0 1
|
||||||
|
#define VERSION_2_1_0 2
|
||||||
|
#define VERSION_2_2_0 3
|
||||||
|
#define VERSION_2_3_0 4
|
||||||
|
#define VERSION_3_0_0 5
|
||||||
|
#define VERSION_3_0_1 6
|
||||||
|
#define VERSION_3_0_2 7
|
||||||
|
#define VERSION_4_0_0 8
|
||||||
|
#define VERSION_4_0_1 9
|
||||||
|
#define VERSION_4_1_0 10
|
||||||
|
#define VERSION_5_0_0 11
|
||||||
|
#define VERSION_5_0_1 12
|
||||||
|
#define VERSION_5_0_2 13
|
||||||
|
#define VERSION_5_1_0 14
|
||||||
|
|
||||||
|
#define TARGET_VERSION VERSION_5_1_0
|
||||||
|
|
||||||
#include "IpcStubs.h"
|
#include "IpcStubs.h"
|
||||||
|
|
2
SwIPC
2
SwIPC
|
@ -1 +1 @@
|
||||||
Subproject commit 4282ebae9017873b6ae9940e781ef6026026282c
|
Subproject commit 9bb842022806979ce6f6c97dce686c378c386c86
|
|
@ -67,15 +67,15 @@ def splitByNs(obj):
|
||||||
ons[ns][name] = x
|
ons[ns][name] = x
|
||||||
return ons
|
return ons
|
||||||
|
|
||||||
def retype(spec, noIndex=False, forStruct=False):
|
def retype(spec, noIndex=False, noArray=False):
|
||||||
if spec[0] == 'unknown':
|
if spec[0] == 'unknown':
|
||||||
return 'uint8_t'
|
return 'uint8_t'
|
||||||
elif spec[0] == 'bytes':
|
elif spec[0] == 'bytes':
|
||||||
if forStruct:
|
if noArray:
|
||||||
return 'uint8_t'
|
return 'uint8_t'
|
||||||
return 'uint8_t%s' % ('[%s]' % emitInt(spec[1]) if not noIndex else ' *')
|
return 'uint8_t%s' % ('[%s]' % emitInt(spec[1]) if not noIndex else ' *')
|
||||||
else:
|
else:
|
||||||
return typemap[spec[0]] if spec[0] in typemap else spec[0]
|
return typemap[spec[0]] if spec[0] in typemap else spec[0];
|
||||||
|
|
||||||
def formatParam(param, input, i):
|
def formatParam(param, input, i):
|
||||||
name, spec = param
|
name, spec = param
|
||||||
|
@ -92,7 +92,7 @@ def formatParam(param, input, i):
|
||||||
elif spec[0] == 'unknown':
|
elif spec[0] == 'unknown':
|
||||||
assert False
|
assert False
|
||||||
elif spec[0] == 'buffer':
|
elif spec[0] == 'buffer':
|
||||||
type = '%s *' % retype(spec[1])
|
type = '%s *' % retype(spec[1], noArray=True)
|
||||||
hasSize = True
|
hasSize = True
|
||||||
elif spec[0] == 'array':
|
elif spec[0] == 'array':
|
||||||
type = retype(spec[1]) + ' *'
|
type = retype(spec[1]) + ' *'
|
||||||
|
@ -112,7 +112,6 @@ def formatParam(param, input, i):
|
||||||
type = type[:-len(arrspec)]
|
type = type[:-len(arrspec)]
|
||||||
else:
|
else:
|
||||||
arrspec = ''
|
arrspec = ''
|
||||||
|
|
||||||
return '%s %s%s %s%s%s' % ('IN' if input else 'OUT', type, '&' if not input and (not type.endswith('*') and not arrspec) else '', name, arrspec, ', guint %s_size' % name if hasSize else '')
|
return '%s %s%s %s%s%s' % ('IN' if input else 'OUT', type, '&' if not input and (not type.endswith('*') and not arrspec) else '', name, arrspec, ', guint %s_size' % name if hasSize else '')
|
||||||
|
|
||||||
def generatePrototype(func):
|
def generatePrototype(func):
|
||||||
|
@ -125,7 +124,7 @@ def isPointerType(type):
|
||||||
return True
|
return True
|
||||||
elif type[0] in allTypes:
|
elif type[0] in allTypes:
|
||||||
return isPointerType(allTypes[type[0]])
|
return isPointerType(allTypes[type[0]])
|
||||||
elif type[0] == 'struct':
|
elif type[0] == 'struct' or type[0] == 'enum':
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -156,9 +155,9 @@ def generateCaller(qname, fname, func):
|
||||||
yield 'auto %s = req.getBuffer(%s, %i, %s);' % (an, emitInt(rest[1]), cbo, sn)
|
yield 'auto %s = req.getBuffer(%s, %i, %s);' % (an, emitInt(rest[1]), cbo, sn)
|
||||||
yield 'auto %s = new uint8_t[%s];' % (bn, sn)
|
yield 'auto %s = new uint8_t[%s];' % (bn, sn)
|
||||||
yield 'ctu->cpu.readmem(%s, %s, %s);' % (an, bn, sn)
|
yield 'ctu->cpu.readmem(%s, %s, %s);' % (an, bn, sn)
|
||||||
params.append('(%s *) %s' % (retype(rest[0]), bn))
|
params.append('(%s *) %s' % (retype(rest[0], noArray=True), bn))
|
||||||
params.append(sn)
|
params.append(sn)
|
||||||
logFmt.append('%s *%s= buffer<0x" ADDRFMT ">' % (retype(rest[0]), '%s ' % name if name else ''))
|
logFmt.append('%s *%s= buffer<0x" ADDRFMT ">' % (retype(rest[0], noArray=True), '%s ' % name if name else ''))
|
||||||
logElems.append(sn)
|
logElems.append(sn)
|
||||||
bufSizes += 1
|
bufSizes += 1
|
||||||
yield AFTER, 'delete[] %s;' % bn
|
yield AFTER, 'delete[] %s;' % bn
|
||||||
|
@ -301,6 +300,29 @@ def parsePartials(code):
|
||||||
code = '\n'.join(re.findall(r'/\*\$IPC\$(.*?)\*/', code, re.M|re.S))
|
code = '\n'.join(re.findall(r'/\*\$IPC\$(.*?)\*/', code, re.M|re.S))
|
||||||
return partialparser.parse(code)
|
return partialparser.parse(code)
|
||||||
|
|
||||||
|
def getVersionName(version):
|
||||||
|
if version == None:
|
||||||
|
return None
|
||||||
|
return "VERSION_%s" % version.replace(".", "_")
|
||||||
|
|
||||||
|
def getVersionId(target_version):
|
||||||
|
for id, version in enumerate(idparser.versionInfo):
|
||||||
|
if (version == target_version):
|
||||||
|
return id
|
||||||
|
return -1
|
||||||
|
|
||||||
|
|
||||||
|
def generateVersionChecks(first_version, last_version):
|
||||||
|
first_version_id = getVersionId(first_version)
|
||||||
|
last_version_id = getVersionId(last_version)
|
||||||
|
if first_version_id > 0 and last_version_id != -1:
|
||||||
|
return '#if TARGET_VERSION >= %s && TARGET_VERSION <= %s' % (getVersionName(first_version), getVersionName(last_version))
|
||||||
|
if first_version_id > 0:
|
||||||
|
return '#if TARGET_VERSION >= %s' % getVersionName(first_version)
|
||||||
|
elif last_version_id != -1:
|
||||||
|
return '#if TARGET_VERSION <= %s' % getVersionName(last_version)
|
||||||
|
return None
|
||||||
|
|
||||||
usedInts = []
|
usedInts = []
|
||||||
def uniqInt(*args):
|
def uniqInt(*args):
|
||||||
args = ''.join(map(str, args))
|
args = ''.join(map(str, args))
|
||||||
|
@ -314,15 +336,7 @@ def uniqInt(*args):
|
||||||
def main():
|
def main():
|
||||||
global allTypes
|
global allTypes
|
||||||
|
|
||||||
fns = ['SwIPC/ipcdefs/auto.id'] + [x for x in glob.glob('SwIPC/ipcdefs/*.id') if x != 'SwIPC/ipcdefs/auto.id']
|
types, ifaces, services = idparser.getAll()
|
||||||
|
|
||||||
if os.path.exists('SwIPC/ipcdefs/cache') and all(os.path.getmtime('SwIPC/ipcdefs/cache') > os.path.getmtime(x) for x in fns):
|
|
||||||
res = json.load(file('SwIPC/ipcdefs/cache'))
|
|
||||||
else:
|
|
||||||
res = idparser.parse('\n'.join(file(fn).read() for fn in fns))
|
|
||||||
with file('SwIPC/ipcdefs/cache', 'w') as fp:
|
|
||||||
json.dump(res, fp)
|
|
||||||
types, ifaces, services = res
|
|
||||||
|
|
||||||
allTypes = types
|
allTypes = types
|
||||||
|
|
||||||
|
@ -339,7 +353,12 @@ def main():
|
||||||
extra_data = ''
|
extra_data = ''
|
||||||
if sub_spec[1][0] == 'bytes':
|
if sub_spec[1][0] == 'bytes':
|
||||||
extra_data = '[%s]' % emitInt(sub_spec[1][1])
|
extra_data = '[%s]' % emitInt(sub_spec[1][1])
|
||||||
namespaces[ns].append('\t%s %s%s;' % (retype(sub_spec[1], forStruct=True), sub_spec[0], extra_data))
|
namespaces[ns].append('\t%s %s%s;' % (retype(sub_spec[1], noArray=True), sub_spec[0], extra_data))
|
||||||
|
namespaces[ns].append('};')
|
||||||
|
elif spec[0] == 'enum':
|
||||||
|
namespaces[ns].append('using %s = enum {' % (name))
|
||||||
|
for sub_spec in spec[1:][0]:
|
||||||
|
namespaces[ns].append('\t%s = %d,' % (sub_spec[0], sub_spec[1]))
|
||||||
namespaces[ns].append('};')
|
namespaces[ns].append('};')
|
||||||
else:
|
else:
|
||||||
retyped, plain = retype(spec, noIndex=True), retype(spec)
|
retyped, plain = retype(spec, noIndex=True), retype(spec)
|
||||||
|
@ -354,6 +373,12 @@ def main():
|
||||||
print >>fp, '#include "Ctu.h"'
|
print >>fp, '#include "Ctu.h"'
|
||||||
print >>fp
|
print >>fp
|
||||||
|
|
||||||
|
for id, version in enumerate(idparser.versionInfo):
|
||||||
|
version = getVersionName(version)
|
||||||
|
print >>fp,"#ifndef %s" % (version)
|
||||||
|
print >>fp, "#define %s %d" % (version, id)
|
||||||
|
print >>fp, "#endif\n"
|
||||||
|
|
||||||
print >>fp, '#define SERVICE_MAPPING() do { \\'
|
print >>fp, '#define SERVICE_MAPPING() do { \\'
|
||||||
for iname, snames in sorted(services.items(), key=lambda x: x[0]):
|
for iname, snames in sorted(services.items(), key=lambda x: x[0]):
|
||||||
for sname in snames:
|
for sname in snames:
|
||||||
|
@ -397,9 +422,14 @@ def main():
|
||||||
print >>fp, '\t\tuint32_t dispatch(IncomingIpcMessage &req, OutgoingIpcMessage &resp) {'
|
print >>fp, '\t\tuint32_t dispatch(IncomingIpcMessage &req, OutgoingIpcMessage &resp) {'
|
||||||
print >>fp, '\t\t\tswitch(req.cmdId) {'
|
print >>fp, '\t\t\tswitch(req.cmdId) {'
|
||||||
for func in sorted(funcs['cmds'], key=lambda x: x['cmdId']):
|
for func in sorted(funcs['cmds'], key=lambda x: x['cmdId']):
|
||||||
|
conditional_case = generateVersionChecks(func['versionAdded'], func['lastVersion'])
|
||||||
|
if conditional_case != None:
|
||||||
|
print >>fp, '\t\t\t%s' % conditional_case
|
||||||
print >>fp, '\t\t\tcase %i: {' % func['cmdId']
|
print >>fp, '\t\t\tcase %i: {' % func['cmdId']
|
||||||
print >>fp, '\n'.join('\t\t\t\t' + x for x in reorder(generateCaller(qname, func['name'], func)))
|
print >>fp, '\n'.join('\t\t\t\t' + x for x in reorder(generateCaller(qname, func['name'], func)))
|
||||||
print >>fp, '\t\t\t}'
|
print >>fp, '\t\t\t}'
|
||||||
|
if conditional_case != None:
|
||||||
|
print >>fp, '\t\t\t#endif'
|
||||||
print >>fp, '\t\t\tdefault:'
|
print >>fp, '\t\t\tdefault:'
|
||||||
print >>fp, '\t\t\t\tLOG_ERROR(IpcStubs, "Unknown message cmdId %%u to interface %s", req.cmdId);' % ('%s::%s' % (ns, name) if ns else name)
|
print >>fp, '\t\t\t\tLOG_ERROR(IpcStubs, "Unknown message cmdId %%u to interface %s", req.cmdId);' % ('%s::%s' % (ns, name) if ns else name)
|
||||||
print >>fp, '\t\t\t}'
|
print >>fp, '\t\t\t}'
|
||||||
|
@ -407,7 +437,12 @@ def main():
|
||||||
for func in sorted(funcs['cmds'], key=lambda x: x['name']):
|
for func in sorted(funcs['cmds'], key=lambda x: x['name']):
|
||||||
fname = func['name']
|
fname = func['name']
|
||||||
implemented = re.search('[^a-zA-Z0-9:]%s::%s[^a-zA-Z0-9:]' % (qname, fname), allcode)
|
implemented = re.search('[^a-zA-Z0-9:]%s::%s[^a-zA-Z0-9:]' % (qname, fname), allcode)
|
||||||
|
conditional_case = generateVersionChecks(func['versionAdded'], func['lastVersion'])
|
||||||
|
if conditional_case != None:
|
||||||
|
print >>fp, '\t\t%s' % conditional_case
|
||||||
print >>fp, '\t\tuint32_t %s(%s);' % (fname, generatePrototype(func))
|
print >>fp, '\t\tuint32_t %s(%s);' % (fname, generatePrototype(func))
|
||||||
|
if conditional_case != None:
|
||||||
|
print >>fp, '\t\t#endif'
|
||||||
if partial:
|
if partial:
|
||||||
for x in partial[0]:
|
for x in partial[0]:
|
||||||
print >>fp, '\t\t%s' % x
|
print >>fp, '\t\t%s' % x
|
||||||
|
@ -422,6 +457,9 @@ def main():
|
||||||
fname = func['name']
|
fname = func['name']
|
||||||
implemented = re.search('[^a-zA-Z0-9:]%s::%s[^a-zA-Z0-9:]' % (qname, fname), allcode)
|
implemented = re.search('[^a-zA-Z0-9:]%s::%s[^a-zA-Z0-9:]' % (qname, fname), allcode)
|
||||||
if not implemented:
|
if not implemented:
|
||||||
|
conditional_case = generateVersionChecks(func['versionAdded'], func['lastVersion'])
|
||||||
|
if conditional_case != None:
|
||||||
|
print >>fp, '%s' % conditional_case
|
||||||
print >>fp, 'uint32_t %s::%s(%s) {' % (qname, fname, generatePrototype(func))
|
print >>fp, 'uint32_t %s::%s(%s) {' % (qname, fname, generatePrototype(func))
|
||||||
print >>fp, '\tLOG_DEBUG(IpcStubs, "Stub implementation for %s::%s");' % (qname, fname)
|
print >>fp, '\tLOG_DEBUG(IpcStubs, "Stub implementation for %s::%s");' % (qname, fname)
|
||||||
for i, (name, elem) in enumerate(func['outputs']):
|
for i, (name, elem) in enumerate(func['outputs']):
|
||||||
|
@ -436,6 +474,8 @@ def main():
|
||||||
print >>fp, '\t%s = make_shared<FauxHandle>(0x%x);' % (name, uniqInt(qname, fname, name))
|
print >>fp, '\t%s = make_shared<FauxHandle>(0x%x);' % (name, uniqInt(qname, fname, name))
|
||||||
print >>fp, '\treturn 0;'
|
print >>fp, '\treturn 0;'
|
||||||
print >>fp, '}'
|
print >>fp, '}'
|
||||||
|
if conditional_case != None:
|
||||||
|
print >>fp, '#endif'
|
||||||
print >>fp, '#endif // DEFINE_STUBS'
|
print >>fp, '#endif // DEFINE_STUBS'
|
||||||
|
|
||||||
code = fp.getvalue()
|
code = fp.getvalue()
|
||||||
|
|
|
@ -27,7 +27,7 @@ nn::socket::sf::IClient::IClient(Ctu *_ctu) : IpcService(_ctu) {
|
||||||
passthrough = _ctu->socketsEnabled;
|
passthrough = _ctu->socketsEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::socket::sf::IClient::Accept(IN uint32_t socket, OUT int32_t& ret, OUT uint32_t& bsd_errno, OUT uint32_t& sockaddr_len, OUT sockaddr * _4, guint _4_size) {
|
uint32_t nn::socket::sf::IClient::Accept(IN uint32_t socket, OUT int32_t& ret, OUT uint32_t& bsd_errno, OUT uint32_t& sockaddr_len, OUT nn::socket::sockaddr_in * _4, guint _4_size) {
|
||||||
LOG_DEBUG(IpcStubs, "Stub implementation for nn::socket::sf::IClient::accept");
|
LOG_DEBUG(IpcStubs, "Stub implementation for nn::socket::sf::IClient::accept");
|
||||||
if(passthrough) {
|
if(passthrough) {
|
||||||
struct sockaddr *addr = (struct sockaddr *) _4;
|
struct sockaddr *addr = (struct sockaddr *) _4;
|
||||||
|
@ -42,7 +42,8 @@ uint32_t nn::socket::sf::IClient::Accept(IN uint32_t socket, OUT int32_t& ret, O
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
uint32_t nn::socket::sf::IClient::Bind(IN uint32_t socket, IN sockaddr * _1, guint _1_size, OUT int32_t& ret, OUT uint32_t& bsd_errno) {
|
|
||||||
|
uint32_t nn::socket::sf::IClient::Bind(IN uint32_t socket, IN nn::socket::sockaddr_in * _1, guint _1_size, OUT int32_t& ret, OUT uint32_t& bsd_errno) {
|
||||||
LOG_DEBUG(IpcStubs, "Stub implementation for nn::socket::sf::IClient::bind");
|
LOG_DEBUG(IpcStubs, "Stub implementation for nn::socket::sf::IClient::bind");
|
||||||
if(passthrough) {
|
if(passthrough) {
|
||||||
struct sockaddr *addr = (struct sockaddr *) _1;
|
struct sockaddr *addr = (struct sockaddr *) _1;
|
||||||
|
@ -66,7 +67,7 @@ uint32_t nn::socket::sf::IClient::Close(IN uint32_t socket, OUT int32_t& ret, OU
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
uint32_t nn::socket::sf::IClient::Connect(IN uint32_t socket, IN sockaddr * _1, guint _1_size, OUT int32_t& ret, OUT uint32_t& bsd_errno) {
|
uint32_t nn::socket::sf::IClient::Connect(IN uint32_t socket, IN nn::socket::sockaddr_in * _1, guint _1_size, OUT int32_t& ret, OUT uint32_t& bsd_errno) {
|
||||||
LOG_DEBUG(IpcStubs, "Stub implementation for nn::socket::sf::IClient::connect");
|
LOG_DEBUG(IpcStubs, "Stub implementation for nn::socket::sf::IClient::connect");
|
||||||
if(passthrough) {
|
if(passthrough) {
|
||||||
struct sockaddr *addr = (struct sockaddr *) _1;
|
struct sockaddr *addr = (struct sockaddr *) _1;
|
||||||
|
@ -79,7 +80,7 @@ uint32_t nn::socket::sf::IClient::Connect(IN uint32_t socket, IN sockaddr * _1,
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
uint32_t nn::socket::sf::IClient::GetSockName(IN uint32_t socket, OUT int32_t& ret, OUT uint32_t& bsd_errno, OUT uint32_t& sockaddr_len, OUT sockaddr * _4, guint _4_size) {
|
uint32_t nn::socket::sf::IClient::GetSockName(IN uint32_t socket, OUT int32_t& ret, OUT uint32_t& bsd_errno, OUT uint32_t& sockaddr_len, OUT nn::socket::sockaddr_in * _4, guint _4_size) {
|
||||||
LOG_DEBUG(IpcStubs, "Stub implementation for nn::socket::sf::IClient::getsockname");
|
LOG_DEBUG(IpcStubs, "Stub implementation for nn::socket::sf::IClient::getsockname");
|
||||||
if(passthrough) {
|
if(passthrough) {
|
||||||
struct sockaddr *addr = (struct sockaddr *) _4;
|
struct sockaddr *addr = (struct sockaddr *) _4;
|
||||||
|
@ -128,7 +129,7 @@ uint32_t nn::socket::sf::IClient::Send(IN uint32_t socket, IN uint32_t flags, IN
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
uint32_t nn::socket::sf::IClient::SendTo(IN uint32_t socket, IN uint32_t flags, IN int8_t * _2, guint _2_size, IN sockaddr * _3, guint _3_size, OUT int32_t& ret, OUT uint32_t& bsd_errno) {
|
uint32_t nn::socket::sf::IClient::SendTo(IN uint32_t socket, IN uint32_t flags, IN int8_t * _2, guint _2_size, IN nn::socket::sockaddr_in * _3, guint _3_size, OUT int32_t& ret, OUT uint32_t& bsd_errno) {
|
||||||
LOG_DEBUG(IpcStubs, "Stub implementation for nn::socket::sf::IClient::sendto");
|
LOG_DEBUG(IpcStubs, "Stub implementation for nn::socket::sf::IClient::sendto");
|
||||||
if(passthrough) {
|
if(passthrough) {
|
||||||
struct sockaddr *addr = (struct sockaddr *) _3;
|
struct sockaddr *addr = (struct sockaddr *) _3;
|
||||||
|
|
141
ipcimpl/fsp.cpp
141
ipcimpl/fsp.cpp
|
@ -60,7 +60,7 @@ uint32_t nn::fssrv::sf::IStorage::GetSize(OUT uint64_t& size) {
|
||||||
LOG_DEBUG(Fsp, "Failed to get file size!");
|
LOG_DEBUG(Fsp, "Failed to get file size!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
uint32_t nn::fssrv::sf::IStorage::Read(IN uint64_t offset, IN uint64_t length, OUT int8_t * buffer, guint buffer_size) {
|
uint32_t nn::fssrv::sf::IStorage::Read(IN uint64_t offset, IN uint64_t length, OUT uint8_t * buffer, guint buffer_size) {
|
||||||
if(isOpen && fp != nullptr) {
|
if(isOpen && fp != nullptr) {
|
||||||
uint32_t s = ((uint32_t)buffer_size < (uint32_t)length ? (uint32_t)buffer_size : (uint32_t)length);
|
uint32_t s = ((uint32_t)buffer_size < (uint32_t)length ? (uint32_t)buffer_size : (uint32_t)length);
|
||||||
bufferOffset = offset;
|
bufferOffset = offset;
|
||||||
|
@ -87,7 +87,7 @@ uint32_t nn::fssrv::sf::IStorage::SetSize(IN uint64_t size) {
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
uint32_t nn::fssrv::sf::IStorage::Write(IN uint64_t offset, IN uint64_t length, IN int8_t * data, guint data_size) {
|
uint32_t nn::fssrv::sf::IStorage::Write(IN uint64_t offset, IN uint64_t length, IN uint8_t * data, guint data_size) {
|
||||||
if(isOpen && fp != nullptr) {
|
if(isOpen && fp != nullptr) {
|
||||||
bufferOffset = offset;
|
bufferOffset = offset;
|
||||||
uint32_t s = ((uint32_t)data_size < (uint32_t)length ? (uint32_t)data_size : (uint32_t)length);
|
uint32_t s = ((uint32_t)data_size < (uint32_t)length ? (uint32_t)data_size : (uint32_t)length);
|
||||||
|
@ -106,19 +106,21 @@ uint32_t nn::fssrv::sf::IStorage::Write(IN uint64_t offset, IN uint64_t length,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Funcs
|
// Funcs
|
||||||
uint32_t nn::fssrv::sf::IFileSystemProxy::OpenBisPartition(IN nn::fssrv::sf::Partition partitionID, OUT shared_ptr<nn::fssrv::sf::IStorage>& BisPartition) {
|
uint32_t nn::fssrv::sf::IFileSystemProxy::OpenBisStorage(IN nn::fssrv::sf::Partition partitionID, OUT shared_ptr<nn::fssrv::sf::IStorage>& BisPartition) {
|
||||||
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenBisPartition");
|
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenBisStorage");
|
||||||
BisPartition = buildInterface(nn::fssrv::sf::IStorage, "bis.istorage");
|
BisPartition = buildInterface(nn::fssrv::sf::IStorage, "bis.istorage");
|
||||||
return 0x0;
|
return 0x0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::fssrv::sf::IFileSystemProxy::OpenDataStorageByApplicationId(IN nn::ApplicationId tid, OUT shared_ptr<nn::fssrv::sf::IStorage>& dataStorage) {
|
#if TARGET_VERSION >= VERSION_3_0_0
|
||||||
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenDataStorageByApplicationId 0x" ADDRFMT, tid);
|
uint32_t nn::fssrv::sf::IFileSystemProxy::OpenDataStorageByProgramId(IN nn::ApplicationId tid, OUT shared_ptr<nn::fssrv::sf::IStorage>& dataStorage) {
|
||||||
|
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenDataStorageByProgramId 0x" ADDRFMT, tid);
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << "tid_archives_" << hex << tid << ".istorage";
|
ss << "tid_archives_" << hex << tid << ".istorage";
|
||||||
dataStorage = buildInterface(nn::fssrv::sf::IStorage, ss.str());
|
dataStorage = buildInterface(nn::fssrv::sf::IStorage, ss.str());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
uint32_t nn::fssrv::sf::IFileSystemProxy::OpenDataStorageByCurrentProcess(OUT shared_ptr<nn::fssrv::sf::IStorage>& dataStorage) {
|
uint32_t nn::fssrv::sf::IFileSystemProxy::OpenDataStorageByCurrentProcess(OUT shared_ptr<nn::fssrv::sf::IStorage>& dataStorage) {
|
||||||
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenDataStorageByCurrentProcess");
|
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenDataStorageByCurrentProcess");
|
||||||
|
@ -127,22 +129,23 @@ uint32_t nn::fssrv::sf::IFileSystemProxy::OpenDataStorageByCurrentProcess(OUT sh
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::fssrv::sf::IFileSystemProxy::OpenDataStorageByDataId(IN nn::ApplicationId tid, IN uint8_t storageId, OUT shared_ptr<nn::fssrv::sf::IStorage>& dataStorage) {
|
uint32_t nn::fssrv::sf::IFileSystemProxy::OpenDataStorageByDataId(IN uint8_t storageId, IN nn::ApplicationId tid, OUT shared_ptr<nn::fssrv::sf::IStorage>& dataStorage) {
|
||||||
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenDataStorageByDataId 0x" ADDRFMT, 0x0100000000000800+(uint64_t)storageId);
|
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenDataStorageByDataId 0x" ADDRFMT, tid);
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << "archives/" << hex << setw(16) << setfill('0') << 0x0100000000000800+(uint64_t)storageId << ".istorage";
|
ss << "archives/" << hex << setw(16) << setfill('0') << tid << ".istorage";
|
||||||
|
|
||||||
dataStorage = buildInterface(nn::fssrv::sf::IStorage, ss.str());
|
dataStorage = buildInterface(nn::fssrv::sf::IStorage, ss.str());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::fssrv::sf::IFileSystemProxy::OpenGameCardPartition(IN nn::fssrv::sf::Partition partitionID, IN uint32_t _1, OUT shared_ptr<nn::fssrv::sf::IStorage>& gameCardFs) {
|
uint32_t nn::fssrv::sf::IFileSystemProxy::OpenGameCardStorage(IN nn::fssrv::sf::Partition partitionID, IN uint32_t _1, OUT shared_ptr<nn::fssrv::sf::IStorage>& gameCardFs) {
|
||||||
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenGameCardPartition");
|
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenGameCardStorage");
|
||||||
gameCardFs = buildInterface(nn::fssrv::sf::IStorage, "GamePartition.istorage");
|
gameCardFs = buildInterface(nn::fssrv::sf::IStorage, "GamePartition.istorage");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::fssrv::sf::IFileSystemProxy::OpenRomStorage(OUT shared_ptr<nn::fssrv::sf::IStorage>& _0) {
|
uint32_t nn::fssrv::sf::IFileSystemProxy::OpenPatchDataStorageByCurrentProcess(OUT shared_ptr<nn::fssrv::sf::IStorage>& _0) {
|
||||||
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenRomStorage");
|
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenPatchDataStorageByCurrentProcess");
|
||||||
_0 = buildInterface(nn::fssrv::sf::IStorage, "RomStorage.istorage");
|
_0 = buildInterface(nn::fssrv::sf::IStorage, "RomStorage.istorage");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -156,13 +159,13 @@ nn::fssrv::sf::IFileSystem::IFileSystem(Ctu *_ctu, string _fnPath) : IpcService
|
||||||
LOG_DEBUG(Fsp, "Open path %s", fnPath.c_str());
|
LOG_DEBUG(Fsp, "Open path %s", fnPath.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::fssrv::sf::IFileSystem::DeleteFile(IN int8_t * path, guint path_size) {
|
uint32_t nn::fssrv::sf::IFileSystem::DeleteFile(IN uint8_t * path, guint path_size) {
|
||||||
LOG_DEBUG(Fsp, "Delete file %s", (fnPath+string((char*)path)).c_str());
|
LOG_DEBUG(Fsp, "Delete file %s", (fnPath+string((char*)path)).c_str());
|
||||||
remove((fnPath+string((char*)path)).c_str());
|
remove((fnPath+string((char*)path)).c_str());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::fssrv::sf::IFileSystem::CreateFile(IN uint32_t mode, IN uint64_t size, IN int8_t * path, guint path_size) {
|
uint32_t nn::fssrv::sf::IFileSystem::CreateFile(IN uint32_t mode, IN uint64_t size, IN uint8_t * path, guint path_size) {
|
||||||
LOG_DEBUG(Fsp, "Create file %s", (fnPath+string((char*)path)).c_str());
|
LOG_DEBUG(Fsp, "Create file %s", (fnPath+string((char*)path)).c_str());
|
||||||
FILE *fp = fopen((fnPath+string((char*)path)).c_str(), "wb");
|
FILE *fp = fopen((fnPath+string((char*)path)).c_str(), "wb");
|
||||||
if(!fp)
|
if(!fp)
|
||||||
|
@ -171,22 +174,22 @@ uint32_t nn::fssrv::sf::IFileSystem::CreateFile(IN uint32_t mode, IN uint64_t si
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::fssrv::sf::IFileSystem::CreateDirectory(IN int8_t * path, guint path_size) {
|
uint32_t nn::fssrv::sf::IFileSystem::CreateDirectory(IN uint8_t * path, guint path_size) {
|
||||||
LOG_DEBUG(Fsp, "Create directory %s", (fnPath+string((char*)path)).c_str());
|
LOG_DEBUG(Fsp, "Create directory %s", (fnPath+string((char*)path)).c_str());
|
||||||
if (mkdir((fnPath+string((char*)path)).c_str(), 0755) == -1)
|
if (mkdir((fnPath+string((char*)path)).c_str(), 0755) == -1)
|
||||||
return 0x7d402;
|
return 0x7d402;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::fssrv::sf::IFileSystem::GetEntryType(IN int8_t * path, guint path_size, OUT uint32_t& _1) {
|
uint32_t nn::fssrv::sf::IFileSystem::GetEntryType(IN uint8_t * path, guint path_size, OUT nn::fssrv::sf::DirectoryEntryType& _1) {
|
||||||
LOG_DEBUG(IpcStubs, "GetEntryType for file %s", (fnPath + string((char*)path)).c_str());
|
LOG_DEBUG(IpcStubs, "GetEntryType for file %s", (fnPath + string((char*)path)).c_str());
|
||||||
struct stat path_stat;
|
struct stat path_stat;
|
||||||
|
|
||||||
stat((fnPath+string((char*)path)).c_str(), &path_stat);
|
stat((fnPath+string((char*)path)).c_str(), &path_stat);
|
||||||
if (S_ISREG(path_stat.st_mode))
|
if (S_ISREG(path_stat.st_mode))
|
||||||
_1 = 1;
|
_1 = File;
|
||||||
else if (S_ISDIR(path_stat.st_mode))
|
else if (S_ISDIR(path_stat.st_mode))
|
||||||
_1 = 0;
|
_1 = Directory;
|
||||||
else
|
else
|
||||||
return 0x271002;
|
return 0x271002;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -194,95 +197,111 @@ uint32_t nn::fssrv::sf::IFileSystem::GetEntryType(IN int8_t * path, guint path_s
|
||||||
|
|
||||||
|
|
||||||
// Funcs
|
// Funcs
|
||||||
|
#if TARGET_VERSION == VERSION_1_0_0
|
||||||
|
uint32_t nn::fssrv::sf::IFileSystemProxy::OpenFileSystem(IN nn::fssrv::sf::FileSystemType filesystem_type, IN nn::ApplicationId tid, IN uint8_t * path, guint path_size, OUT shared_ptr<nn::fssrv::sf::IFileSystem>& contentFs) {
|
||||||
|
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenFileSystem");
|
||||||
|
contentFs = buildInterface(nn::fssrv::sf::IFileSystem, "");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
uint32_t nn::fssrv::sf::IFileSystemProxy::OpenDataFileSystemByCurrentProcess(OUT shared_ptr<nn::fssrv::sf::IFileSystem>& _0) {
|
uint32_t nn::fssrv::sf::IFileSystemProxy::OpenDataFileSystemByCurrentProcess(OUT shared_ptr<nn::fssrv::sf::IFileSystem>& _0) {
|
||||||
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenDataFileSystemByCurrentProcess");
|
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenDataFileSystemByCurrentProcess");
|
||||||
_0 = buildInterface(nn::fssrv::sf::IFileSystem, "");
|
_0 = buildInterface(nn::fssrv::sf::IFileSystem, "");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::fssrv::sf::IFileSystemProxy::MountContent7(IN nn::ApplicationId tid, IN uint32_t ncaType, OUT shared_ptr<nn::fssrv::sf::IFileSystem>& _2) {
|
#if TARGET_VERSION >= VERSION_2_0_0
|
||||||
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::MountContent7");
|
uint32_t nn::fssrv::sf::IFileSystemProxy::OpenFileSystemWithPatch(IN nn::fssrv::sf::FileSystemType filesystem_type, IN nn::ApplicationId tid, OUT shared_ptr<nn::fssrv::sf::IFileSystem>& _2) {
|
||||||
|
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenFileSystemWithPatch");
|
||||||
_2 = buildInterface(nn::fssrv::sf::IFileSystem, "");
|
_2 = buildInterface(nn::fssrv::sf::IFileSystem, "");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
uint32_t nn::fssrv::sf::IFileSystemProxy::MountContent(IN nn::ApplicationId tid, IN uint32_t flag, IN int8_t * path, guint path_size, OUT shared_ptr<nn::fssrv::sf::IFileSystem>& contentFs) {
|
#if TARGET_VERSION >= VERSION_2_0_0
|
||||||
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::MountContent");
|
uint32_t nn::fssrv::sf::IFileSystemProxy::OpenFileSystemWithId(IN nn::fssrv::sf::FileSystemType filesystem_type, IN nn::ApplicationId tid, IN uint8_t * path, guint path_size, OUT shared_ptr<nn::fssrv::sf::IFileSystem>& contentFs) {
|
||||||
|
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenFileSystemWithId");
|
||||||
contentFs = buildInterface(nn::fssrv::sf::IFileSystem, "");
|
contentFs = buildInterface(nn::fssrv::sf::IFileSystem, "");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if TARGET_VERSION >= VERSION_3_0_0
|
||||||
uint32_t nn::fssrv::sf::IFileSystemProxy::OpenDataFileSystemByApplicationId(IN nn::ApplicationId tid, OUT shared_ptr<nn::fssrv::sf::IFileSystem>& dataFiles) {
|
uint32_t nn::fssrv::sf::IFileSystemProxy::OpenDataFileSystemByApplicationId(IN nn::ApplicationId tid, OUT shared_ptr<nn::fssrv::sf::IFileSystem>& dataFiles) {
|
||||||
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenDataFileSystemByApplicationId");
|
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenDataFileSystemByApplicationId");
|
||||||
dataFiles = buildInterface(nn::fssrv::sf::IFileSystem, "");
|
dataFiles = buildInterface(nn::fssrv::sf::IFileSystem, "");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
uint32_t nn::fssrv::sf::IFileSystemProxy::MountBis(IN nn::fssrv::sf::Partition partitionID, IN int8_t * path, guint path_size, OUT shared_ptr<nn::fssrv::sf::IFileSystem>& Bis) {
|
uint32_t nn::fssrv::sf::IFileSystemProxy::OpenBisFileSystem(IN nn::fssrv::sf::Partition partitionID, IN uint8_t * path, guint path_size, OUT shared_ptr<nn::fssrv::sf::IFileSystem>& Bis) {
|
||||||
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::MountBis");
|
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenBisFileSystem");
|
||||||
Bis = buildInterface(nn::fssrv::sf::IFileSystem, string("BIS/") + to_string(partitionID));
|
Bis = buildInterface(nn::fssrv::sf::IFileSystem, string("BIS/") + to_string(partitionID));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::fssrv::sf::IFileSystemProxy::OpenHostFileSystemImpl(IN int8_t * path, guint path_size, OUT shared_ptr<nn::fssrv::sf::IFileSystem>& _1) {
|
uint32_t nn::fssrv::sf::IFileSystemProxy::OpenHostFileSystem(IN uint8_t * path, guint path_size, OUT shared_ptr<nn::fssrv::sf::IFileSystem>& _1) {
|
||||||
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenHostFileSystemImpl");
|
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenHostFileSystem");
|
||||||
_1 = buildInterface(nn::fssrv::sf::IFileSystem, "");
|
_1 = buildInterface(nn::fssrv::sf::IFileSystem, "");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::fssrv::sf::IFileSystemProxy::MountSdCard(OUT shared_ptr<nn::fssrv::sf::IFileSystem>& sdCard) {
|
uint32_t nn::fssrv::sf::IFileSystemProxy::OpenSdCardFileSystem(OUT shared_ptr<nn::fssrv::sf::IFileSystem>& sdCard) {
|
||||||
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::MountSdCard");
|
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenSdCardFileSystem");
|
||||||
sdCard = buildInterface(nn::fssrv::sf::IFileSystem, "SDCard");
|
sdCard = buildInterface(nn::fssrv::sf::IFileSystem, "SDCard");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::fssrv::sf::IFileSystemProxy::MountGameCardPartition(IN uint32_t _0, IN uint32_t _1, OUT shared_ptr<nn::fssrv::sf::IFileSystem>& gameCardPartitionFs) {
|
uint32_t nn::fssrv::sf::IFileSystemProxy::OpenGameCardFileSystem(IN uint32_t _0, IN uint32_t _1, OUT shared_ptr<nn::fssrv::sf::IFileSystem>& gameCardPartitionFs) {
|
||||||
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::MountGameCardPartition");
|
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenGameCardFileSystem");
|
||||||
gameCardPartitionFs = buildInterface(nn::fssrv::sf::IFileSystem, "GameCard");
|
gameCardPartitionFs = buildInterface(nn::fssrv::sf::IFileSystem, "GameCard");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::fssrv::sf::IFileSystemProxy::MountSaveData(IN uint8_t input, IN nn::fssrv::sf::SaveStruct saveStruct, OUT shared_ptr<nn::fssrv::sf::IFileSystem>& saveDataFs) {
|
uint32_t nn::fssrv::sf::IFileSystemProxy::OpenSaveDataFileSystem(IN uint8_t input, IN nn::fssrv::sf::SaveStruct saveStruct, OUT shared_ptr<nn::fssrv::sf::IFileSystem>& saveDataFs) {
|
||||||
uint64_t tid = *(uint64_t *)(&saveStruct[0x18]);
|
uint64_t tid = *(uint64_t *)(&saveStruct[0x18]);
|
||||||
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::MountSaveData 0x" ADDRFMT, tid);
|
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenSaveDataFileSystem 0x" ADDRFMT, tid);
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << "save_" << hex << tid;
|
ss << "save_" << hex << tid;
|
||||||
saveDataFs = buildInterface(nn::fssrv::sf::IFileSystem, ss.str());
|
saveDataFs = buildInterface(nn::fssrv::sf::IFileSystem, ss.str());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::fssrv::sf::IFileSystemProxy::MountSystemSaveData(IN uint8_t input, IN nn::fssrv::sf::SaveStruct saveStruct, OUT shared_ptr<nn::fssrv::sf::IFileSystem>& systemSaveDataFs) {
|
uint32_t nn::fssrv::sf::IFileSystemProxy::OpenSaveDataFileSystemBySystemSaveDataId(IN uint8_t input, IN nn::fssrv::sf::SaveStruct saveStruct, OUT shared_ptr<nn::fssrv::sf::IFileSystem>& systemSaveDataFs) {
|
||||||
uint64_t tid = *(uint64_t *)(&saveStruct[0x18]);
|
uint64_t tid = *(uint64_t *)(&saveStruct[0x18]);
|
||||||
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::MountSystemSaveData 0x" ADDRFMT, tid);
|
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenSaveDataFileSystemBySystemSaveDataId 0x" ADDRFMT, tid);
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << "syssave_" << hex << tid;
|
ss << "syssave_" << hex << tid;
|
||||||
systemSaveDataFs = buildInterface(nn::fssrv::sf::IFileSystem, ss.str());
|
systemSaveDataFs = buildInterface(nn::fssrv::sf::IFileSystem, ss.str());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::fssrv::sf::IFileSystemProxy::MountSaveDataReadOnly(IN uint8_t input, IN nn::fssrv::sf::SaveStruct saveStruct, OUT shared_ptr<nn::fssrv::sf::IFileSystem>& saveDataFs) {
|
#if TARGET_VERSION >= VERSION_2_0_0
|
||||||
|
uint32_t nn::fssrv::sf::IFileSystemProxy::OpenReadOnlySaveDataFileSystem(IN uint8_t input, IN nn::fssrv::sf::SaveStruct saveStruct, OUT shared_ptr<nn::fssrv::sf::IFileSystem>& saveDataFs) {
|
||||||
uint64_t tid = *(uint64_t *)(&saveStruct[0x18]);
|
uint64_t tid = *(uint64_t *)(&saveStruct[0x18]);
|
||||||
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::MountSaveDataReadOnly 0x" ADDRFMT, tid);
|
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenReadOnlySaveDataFileSystem 0x" ADDRFMT, tid);
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << "save_" << hex << tid;
|
ss << "save_" << hex << tid;
|
||||||
saveDataFs = buildInterface(nn::fssrv::sf::IFileSystem, ss.str());
|
saveDataFs = buildInterface(nn::fssrv::sf::IFileSystem, ss.str());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
uint32_t nn::fssrv::sf::IFileSystemProxy::MountImageDirectory(IN uint32_t _0, OUT shared_ptr<nn::fssrv::sf::IFileSystem>& imageFs) {
|
uint32_t nn::fssrv::sf::IFileSystemProxy::OpenImageDirectoryFileSystem(IN uint32_t _0, OUT shared_ptr<nn::fssrv::sf::IFileSystem>& imageFs) {
|
||||||
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::MountImageDirectory");
|
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenImageDirectoryFileSystem");
|
||||||
imageFs = buildInterface(nn::fssrv::sf::IFileSystem, string("Image_") + to_string(_0));
|
imageFs = buildInterface(nn::fssrv::sf::IFileSystem, string("Image_") + to_string(_0));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::fssrv::sf::IFileSystemProxy::MountContentStorage(IN uint32_t contentStorageID, OUT shared_ptr<nn::fssrv::sf::IFileSystem>& contentFs) {
|
uint32_t nn::fssrv::sf::IFileSystemProxy::OpenContentStorageFileSystem(IN uint32_t contentStorageID, OUT shared_ptr<nn::fssrv::sf::IFileSystem>& contentFs) {
|
||||||
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::MountContentStorage");
|
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenContentStorageFileSystem");
|
||||||
contentFs = buildInterface(nn::fssrv::sf::IFileSystem, string("CS_") + to_string(contentStorageID));
|
contentFs = buildInterface(nn::fssrv::sf::IFileSystem, string("CS_") + to_string(contentStorageID));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::fssrv::sf::IFileSystemProxyForLoader::MountCode(IN nn::ApplicationId TID, IN int8_t * contentPath, guint contentPath_size, OUT shared_ptr<nn::fssrv::sf::IFileSystem>& contentFs) {
|
uint32_t nn::fssrv::sf::IFileSystemProxyForLoader::OpenCodeFileSystem(IN nn::ApplicationId TID, IN uint8_t * contentPath, guint contentPath_size, OUT shared_ptr<nn::fssrv::sf::IFileSystem>& contentFs) {
|
||||||
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxyForLoader::MountCode");
|
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxyForLoader::OpenCodeFileSystem");
|
||||||
contentFs = buildInterface(nn::fssrv::sf::IFileSystem, "");
|
contentFs = buildInterface(nn::fssrv::sf::IFileSystem, "");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -302,20 +321,10 @@ nn::fssrv::sf::IDirectory::IDirectory(Ctu *_ctu, string _fn, uint32_t _filter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DirectoryEntry {
|
|
||||||
char path[0x300];
|
|
||||||
uint32_t unk1;
|
|
||||||
uint8_t entry_type;
|
|
||||||
uint8_t pad[3];
|
|
||||||
uint64_t filesize;
|
|
||||||
};
|
|
||||||
|
|
||||||
static_assert(sizeof(DirectoryEntry) == 0x310);
|
uint32_t nn::fssrv::sf::IDirectory::Read(OUT uint64_t& entries_read, OUT nn::fssrv::sf::IDirectoryEntry * entries, guint entries_buf_len) {
|
||||||
|
uint64_t entries_count = entries_buf_len / sizeof(nn::fssrv::sf::IDirectoryEntry);
|
||||||
uint32_t nn::fssrv::sf::IDirectory::Read(OUT uint64_t& entries_read, OUT uint8_t * entries_buf, guint entries_buf_len) {
|
|
||||||
uint64_t entries_count = entries_buf_len / sizeof(DirectoryEntry);
|
|
||||||
LOG_DEBUG(Fsp, "IDirectory::Read: Attempting to read " LONGFMT " entries (from " LONGFMT ")", entries_count, entries_buf_len);
|
LOG_DEBUG(Fsp, "IDirectory::Read: Attempting to read " LONGFMT " entries (from " LONGFMT ")", entries_count, entries_buf_len);
|
||||||
struct DirectoryEntry *entries = (struct DirectoryEntry*)entries_buf;
|
|
||||||
struct dirent *curdir;
|
struct dirent *curdir;
|
||||||
struct stat curdir_stat;
|
struct stat curdir_stat;
|
||||||
uint64_t i;
|
uint64_t i;
|
||||||
|
@ -324,9 +333,9 @@ uint32_t nn::fssrv::sf::IDirectory::Read(OUT uint64_t& entries_read, OUT uint8_t
|
||||||
curdir = readdir((DIR*)fp);
|
curdir = readdir((DIR*)fp);
|
||||||
if (curdir == nullptr)
|
if (curdir == nullptr)
|
||||||
break;
|
break;
|
||||||
strcpy(entries[i].path, curdir->d_name);
|
strcpy((char*)entries[i].path, (char*)curdir->d_name);
|
||||||
entries[i].unk1 = 0;
|
entries[i].unk1 = 0;
|
||||||
entries[i].entry_type = curdir->d_type == DT_DIR ? 0 : 1;
|
entries[i].directory_entry_type = curdir->d_type == DT_DIR ? Directory : File;
|
||||||
if (stat((fn + std::string("/") + std::string(curdir->d_name)).c_str(), &curdir_stat) == -1) {
|
if (stat((fn + std::string("/") + std::string(curdir->d_name)).c_str(), &curdir_stat) == -1) {
|
||||||
LOG_DEBUG(Fsp, "We got an error getting size of %s", curdir->d_name);
|
LOG_DEBUG(Fsp, "We got an error getting size of %s", curdir->d_name);
|
||||||
perror("stat");
|
perror("stat");
|
||||||
|
@ -374,7 +383,7 @@ uint32_t nn::fssrv::sf::IFile::GetSize(OUT uint64_t& fileSize) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::fssrv::sf::IFile::Read(IN uint32_t _0, IN uint64_t offset, IN uint64_t size, OUT uint64_t& out_size, OUT int8_t * out_buf, guint out_buf_size) {
|
uint32_t nn::fssrv::sf::IFile::Read(IN uint32_t _0, IN uint64_t offset, IN uint64_t size, OUT uint64_t& out_size, OUT uint8_t * out_buf, guint out_buf_size) {
|
||||||
LOG_DEBUG(Fsp, "IFile::Read from %s from " LONGFMT, fn.c_str(), offset);
|
LOG_DEBUG(Fsp, "IFile::Read from %s from " LONGFMT, fn.c_str(), offset);
|
||||||
if(isOpen && fp != nullptr) {
|
if(isOpen && fp != nullptr) {
|
||||||
uint64_t s = ((uint64_t)out_buf_size < size ? (uint64_t)out_buf_size : size);
|
uint64_t s = ((uint64_t)out_buf_size < size ? (uint64_t)out_buf_size : size);
|
||||||
|
@ -389,7 +398,7 @@ uint32_t nn::fssrv::sf::IFile::Read(IN uint32_t _0, IN uint64_t offset, IN uint6
|
||||||
return 0x0;
|
return 0x0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::fssrv::sf::IFile::Write(IN uint32_t _0, IN uint64_t offset, IN uint64_t size, IN int8_t * buf, guint buf_size) {
|
uint32_t nn::fssrv::sf::IFile::Write(IN uint32_t _0, IN uint64_t offset, IN uint64_t size, IN uint8_t * buf, guint buf_size) {
|
||||||
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFile::Write");
|
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFile::Write");
|
||||||
if(isOpen && fp != nullptr) {
|
if(isOpen && fp != nullptr) {
|
||||||
bufferOffset = offset;
|
bufferOffset = offset;
|
||||||
|
@ -433,7 +442,7 @@ uint32_t nn::fssrv::sf::IFile::SetSize(IN uint64_t size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Funcs
|
// Funcs
|
||||||
uint32_t nn::fssrv::sf::IFileSystem::OpenFile(IN uint32_t mode, IN int8_t * path, guint path_size, OUT shared_ptr<nn::fssrv::sf::IFile>& file) {
|
uint32_t nn::fssrv::sf::IFileSystem::OpenFile(IN uint32_t mode, IN uint8_t * path, guint path_size, OUT shared_ptr<nn::fssrv::sf::IFile>& file) {
|
||||||
LOG_DEBUG(Fsp, "OpenFile %s", path);
|
LOG_DEBUG(Fsp, "OpenFile %s", path);
|
||||||
auto tempi = buildInterface(nn::fssrv::sf::IFile, fnPath + "/" + string((char*)path), mode);
|
auto tempi = buildInterface(nn::fssrv::sf::IFile, fnPath + "/" + string((char*)path), mode);
|
||||||
if(tempi->isOpen) {
|
if(tempi->isOpen) {
|
||||||
|
@ -443,7 +452,7 @@ uint32_t nn::fssrv::sf::IFileSystem::OpenFile(IN uint32_t mode, IN int8_t * path
|
||||||
return 0x7d402;
|
return 0x7d402;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::fssrv::sf::IFileSystem::OpenDirectory(IN uint32_t filter, IN int8_t * path, guint path_size, OUT shared_ptr<nn::fssrv::sf::IDirectory>& dir) {
|
uint32_t nn::fssrv::sf::IFileSystem::OpenDirectory(IN uint32_t filter, IN uint8_t * path, guint path_size, OUT shared_ptr<nn::fssrv::sf::IDirectory>& dir) {
|
||||||
LOG_DEBUG(Fsp, "OpenDirectory %s", path);
|
LOG_DEBUG(Fsp, "OpenDirectory %s", path);
|
||||||
auto tempi = buildInterface(nn::fssrv::sf::IDirectory, fnPath + "/" + string((char*)path), filter);
|
auto tempi = buildInterface(nn::fssrv::sf::IDirectory, fnPath + "/" + string((char*)path), filter);
|
||||||
if(tempi->isOpen) {
|
if(tempi->isOpen) {
|
||||||
|
@ -453,9 +462,9 @@ uint32_t nn::fssrv::sf::IFileSystem::OpenDirectory(IN uint32_t filter, IN int8_t
|
||||||
return 0x7d402;
|
return 0x7d402;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::fssrv::sf::IFileSystemProxy::OpenSaveDataThumbnailFile(IN uint8_t _0, IN uint8_t * _1, IN uint32_t _2, OUT shared_ptr<nn::fssrv::sf::IFile>& thumbnail) {
|
uint32_t nn::fssrv::sf::IFileSystemProxy::OpenSaveDataMetaFile(IN uint8_t _0, IN uint32_t _1, IN uint8_t * _2, OUT shared_ptr<nn::fssrv::sf::IFileSystem>& imageFs) {
|
||||||
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenSaveDataThumbnailFile");
|
LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenSaveDataMetaFile");
|
||||||
thumbnail = buildInterface(nn::fssrv::sf::IFile, string((char*)_1), _0);
|
imageFs = buildInterface(nn::fssrv::sf::IFileSystem, string((char*)_2));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -463,8 +472,8 @@ uint32_t nn::fssrv::sf::IFileSystemProxy::OpenSaveDataThumbnailFile(IN uint8_t _
|
||||||
/* ---------------------------------------- End of IFile ---------------------------------------- */
|
/* ---------------------------------------- End of IFile ---------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
uint32_t nn::fssrv::sf::IEventNotifier::Unknown0(OUT shared_ptr<KObject>& _0) {
|
uint32_t nn::fssrv::sf::IEventNotifier::GetEventHandle(OUT shared_ptr<KObject>& _0) {
|
||||||
LOG_DEBUG(IpcStubs, "Stub implementation for nn::fssrv::sf::IEventNotifier::Unknown0");
|
LOG_DEBUG(IpcStubs, "Stub implementation for nn::fssrv::sf::IEventNotifier::GetEventHandle");
|
||||||
_0 = make_shared<Waitable>();
|
_0 = make_shared<Waitable>();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ void dumpstring(uint8_t *data, guint size) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::lm::ILogger::Unknown0(IN uint8_t *message, guint messageSize) {
|
uint32_t nn::lm::ILogger::Initialize(IN uint8_t *message, guint messageSize) {
|
||||||
auto packet = (InLogPacket *) message;
|
auto packet = (InLogPacket *) message;
|
||||||
dumpstring(message, messageSize);
|
dumpstring(message, messageSize);
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
#include "Ctu.h"
|
#include "Ctu.h"
|
||||||
|
|
||||||
uint32_t nn::nim::detail::INetworkInstallManager::Unknown40(OUT uint32_t& _0, OUT uint8_t * _1, guint _1_size) {
|
#if TARGET_VERSION >= VERSION_2_0_0
|
||||||
|
uint32_t nn::nim::detail::INetworkInstallManager::ListApplyDeltaTask2(OUT uint32_t& _0, OUT uint8_t * _1, guint _1_size) {
|
||||||
LOG_DEBUG(IpcStubs, "Stub implementation for nn::nim::detail::INetworkInstallManager::Unknown40");
|
LOG_DEBUG(IpcStubs, "Stub implementation for nn::nim::detail::INetworkInstallManager::Unknown40");
|
||||||
memset(_1, 0xDE, _1_size);
|
memset(_1, 0xDE, _1_size);
|
||||||
_0 = 0;
|
_0 = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "Ctu.h"
|
#include "Ctu.h"
|
||||||
|
|
||||||
uint32_t nn::pm::detail::IShellInterface::LaunchTitle(IN uint64_t _0, IN nn::ApplicationId tid) {
|
uint32_t nn::pm::detail::IShellInterface::LaunchProcess(/*IN uint64_t _0, IN nn::ApplicationId tid*/) {
|
||||||
LOG_DEBUG(Pm::Shell, "Attempted to launch title " ADDRFMT, tid);
|
//LOG_DEBUG(Pm::Shell, "Attempted to launch title " ADDRFMT, tid);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue