Homebrew Access to MVD Service?

devleon

Active Member
OP
Newcomer
Joined
Aug 17, 2016
Messages
32
Trophies
0
Age
28
XP
82
Country
Gambia, The
Hey everyone!

I'm currently working on implementing a moonlight client for the 3ds.
Since moonlight streams in h264, this will be only usable on the N3DS.
Luckily the N3DS provides fast hardware decoding for h264 - the browser, youtube and netflix uses it.

I can access it by using the MVD Service.

Luckily there's already a code example for that here.

I have successfully compiled and uploaded the code to my 3ds, but when trying to call mvdstdInit(), it returns 0xd8e06406 - which as far as I know, means that the service is not accessible.

I'm running the latest Luma on my A9LH N3DS.

I tried accessing the homebrew menu via the homebrew launcher (installed via cia) as well as browserhax to launch my homebrew - but both result in the same error.

How do I make the MVD service accessible to my homebrew? Do I need to use a different CFW? Which one would offer the necessary patches?
 

Ryccardo

Penguin accelerator
Member
Joined
Feb 13, 2015
Messages
7,687
Trophies
1
Age
28
Location
Imola
XP
6,903
Country
Italy
3dsx apps keep the same permissions of the title they're running over (if you didn't configure one, it should use Download Play)...

If you work with cias you'll be able to specify services yourself!
 

devleon

Active Member
OP
Newcomer
Joined
Aug 17, 2016
Messages
32
Trophies
0
Age
28
XP
82
Country
Gambia, The
3dsx apps keep the same permissions of the title they're running over (if you didn't configure one, it should use Download Play)...

If you work with cias you'll be able to specify services yourself!

Awesome, thanks!
How would I make my 3dsx into a cia and specify my own services?
 

devleon

Active Member
OP
Newcomer
Joined
Aug 17, 2016
Messages
32
Trophies
0
Age
28
XP
82
Country
Gambia, The
You could use some sort of svc verification disable patch like https://github.com/AuroraWright/Luma3DS/blob/developer/source/patches.c#L308 or https://github.com/chaoskagami/corbenik/blob/master/contrib/svc_permission_chk_dis.pco
Or create a dummy CIA with access to the mvd service, and use that instead.

Thanks very much. How would I enable the patch in Luma?

Also "The 'Disable SVC Permission Checks' patch is broken. Don't use it." is listed as a known issue in the Corbenik thread. Does that still apply?

I will also try to build my own CIA with the correct permissions in the future.
 

devleon

Active Member
OP
Newcomer
Joined
Aug 17, 2016
Messages
32
Trophies
0
Age
28
XP
82
Country
Gambia, The
Just managed to compile it into a CIA and run it on the system - however as soon as I start decoding the video I get this:

DtvrQ8z.jpg


The dump is attached. Wondering why this happens?

This is my RSF - I made sure to add the mvd to ServiceAccessControl and Dependency.
BasicInfo:
Title : "Moonlight Client"
ProductCode : "CTR-P-MOON" # You can make this whatever you want, it doesn't have to follow the Nintendo standard
Logo : Nintendo # Nintendo / Licensed / Distributed / iQue / iQueForSystem

#RomFs:
# Specifies the root path of the read only file system to include in the ROM.
# RootPath : $(APP_ROMFS)

TitleInfo:
Category : Application
UniqueId : 0xF3F3 #Something like 0x1337, but you can make it whatever you want, as long as it's a hexadecimal number (probably best to make it something actually unique though!)

Option:
UseOnSD : true # true if App is to be installed to SD
FreeProductCode : true # Removes limitations on ProductCode
MediaFootPadding : false # If true CCI files are created with padding
EnableCrypt : false # Enables encryption for NCCH and CIA
EnableCompress : true # Compresses where applicable (currently only exefs:/.code)
AccessControlInfo:
CoreVersion : 2

# Exheader Format Version
DescVersion : 2
# Minimum Required Kernel Version (below is for 4.5.0)
ReleaseKernelMajor : "02"
ReleaseKernelMinor : "33"

# ExtData
UseExtSaveData : false # enables ExtData
#ExtSaveDataId : 0x300 # only set this when the ID is different to the UniqueId

# FS:USER Archive Access Permissions
# Uncomment as required
FileSystemAccess:
- CategorySystemApplication
- CategoryHardwareCheck
- CategoryFileSystemTool
- Debug
- TwlCardBackup
- TwlNandData
- Boss
- DirectSdmc
- Core
- CtrNandRo
- CtrNandRw
- CtrNandRoWrite
- CategorySystemSettings
- CardBoard
- ExportImportIvs
- DirectSdmcWrite
- SwitchCleanup
- SaveDataMove
- Shop
- Shell
- CategoryHomeMenu
- SeedDB

IoAccessControl:
- FsMountNand
- FsMountNandRoWrite
- FsMountTwln
- FsMountWnand
- FsMountCardSpi
- UseSdif3
- CreateSeed
- UseCardSpi

# Process Settings
MemoryType : Application # Application/System/Base
SystemMode : 64MB # 64MB(Default)/96MB/80MB/72MB/32MB
IdealProcessor : 0
AffinityMask : 1
Priority : 16
MaxCpu : 0x9E # Default
HandleTableSize : 0x200
DisableDebug : false
EnableForceDebug : false
CanWriteSharedPage : true
CanUsePrivilegedPriority : false
CanUseNonAlphabetAndNumber : true
PermitMainFunctionArgument : true
CanShareDeviceMemory : true
RunnableOnSleep : false
SpecialMemoryArrange : true

# New3DS Exclusive Process Settings
SystemModeExt : Legacy # Legacy(Default)/124MB/178MB Legacy:Use Old3DS SystemMode
CpuSpeed : 804MHz # 256MHz(Default)/804MHz
EnableL2Cache : true # false(default)/true
CanAccessCore2 : true

# Virtual Address Mappings
IORegisterMapping:
- 1ff00000-1ff7ffff # DSP memory
MemoryMapping:
- 1f000000-1f5fffff:r # VRAM

# Accessible SVCs, <Name>:<ID>
SystemCallAccess:
ControlMemory: 1
QueryMemory: 2
ExitProcess: 3
GetProcessAffinityMask: 4
SetProcessAffinityMask: 5
GetProcessIdealProcessor: 6
SetProcessIdealProcessor: 7
CreateThread: 8
ExitThread: 9
SleepThread: 10
GetThreadPriority: 11
SetThreadPriority: 12
GetThreadAffinityMask: 13
SetThreadAffinityMask: 14
GetThreadIdealProcessor: 15
SetThreadIdealProcessor: 16
GetCurrentProcessorNumber: 17
Run: 18
CreateMutex: 19
ReleaseMutex: 20
CreateSemaphore: 21
ReleaseSemaphore: 22
CreateEvent: 23
SignalEvent: 24
ClearEvent: 25
CreateTimer: 26
SetTimer: 27
CancelTimer: 28
ClearTimer: 29
CreateMemoryBlock: 30
MapMemoryBlock: 31
UnmapMemoryBlock: 32
CreateAddressArbiter: 33
ArbitrateAddress: 34
CloseHandle: 35
WaitSynchronization1: 36
WaitSynchronizationN: 37
SignalAndWait: 38
DuplicateHandle: 39
GetSystemTick: 40
GetHandleInfo: 41
GetSystemInfo: 42
GetProcessInfo: 43
GetThreadInfo: 44
ConnectToPort: 45
SendSyncRequest1: 46
SendSyncRequest2: 47
SendSyncRequest3: 48
SendSyncRequest4: 49
SendSyncRequest: 50
OpenProcess: 51
OpenThread: 52
GetProcessId: 53
GetProcessIdOfThread: 54
GetThreadId: 55
GetResourceLimit: 56
GetResourceLimitLimitValues: 57
GetResourceLimitCurrentValues: 58
GetThreadContext: 59
Break: 60
OutputDebugString: 61
ControlPerformanceCounter: 62
CreatePort: 71
CreateSessionToPort: 72
CreateSession: 73
AcceptSession: 74
ReplyAndReceive1: 75
ReplyAndReceive2: 76
ReplyAndReceive3: 77
ReplyAndReceive4: 78
ReplyAndReceive: 79
BindInterrupt: 80
UnbindInterrupt: 81
InvalidateProcessDataCache: 82
StoreProcessDataCache: 83
FlushProcessDataCache: 84
StartInterProcessDma: 85
StopDma: 86
GetDmaState: 87
RestartDma: 88
DebugActiveProcess: 96
BreakDebugProcess: 97
TerminateDebugProcess: 98
GetProcessDebugEvent: 99
ContinueDebugEvent: 100
GetProcessList: 101
GetThreadList: 102
GetDebugThreadContext: 103
SetDebugThreadContext: 104
QueryDebugProcessMemory: 105
ReadProcessMemory: 106
WriteProcessMemory: 107
SetHardwareBreakPoint: 108
GetDebugThreadParam: 109
ControlProcessMemory: 112
MapProcessMemory: 113
UnmapProcessMemory: 114
CreateCodeSet: 115
CreateProcess: 117
TerminateProcess: 118
SetProcessResourceLimits: 119
CreateResourceLimit: 120
SetResourceLimitValues: 121
AddCodeSegment: 122
Backdoor: 123
KernelSetState: 124
QueryProcessMemory: 125

# Service List
# Maximum 34 services (32 if firmware is prior to 9.6.0)
ServiceAccessControl:
- APT:U
- ac:u
- am:net
- boss:U
- cam:u
- cecd:u
- cfg:nor
- cfg:u
- csnd:SND
- dsp::DSP
- frd:u
- fs:USER
- gsp::Gpu
- gsp::Lcd
- hid:USER
- http:C
- ir:rst
- ir:u
- ir:USER
- mic:u
- ndm:u
- news:s
- nwm::EXT
- nwm::UDS
- ptm:sysm
- ptm:u
- pxi:dev
- soc:U
- ssl:C
- y2r:u
- mvd:STD


SystemControlInfo:
SaveDataSize: 0KB # Change if the app uses savedata
RemasterVersion: 2
StackSize: 0x40000

# Modules that run services listed above should be included below
# Maximum 48 dependencies
# <module name>:<module titleid>
Dependency:
ac: 0x0004013000002402
#act: 0x0004013000003802
am: 0x0004013000001502
boss: 0x0004013000003402
camera: 0x0004013000001602
cecd: 0x0004013000002602
cfg: 0x0004013000001702
codec: 0x0004013000001802
csnd: 0x0004013000002702
dlp: 0x0004013000002802
dsp: 0x0004013000001a02
friends: 0x0004013000003202
gpio: 0x0004013000001b02
gsp: 0x0004013000001c02
hid: 0x0004013000001d02
http: 0x0004013000002902
i2c: 0x0004013000001e02
ir: 0x0004013000003302
mcu: 0x0004013000001f02
mic: 0x0004013000002002
ndm: 0x0004013000002b02
news: 0x0004013000003502
#nfc: 0x0004013000004002
nim: 0x0004013000002c02
nwm: 0x0004013000002d02
pdn: 0x0004013000002102
ps: 0x0004013000003102
ptm: 0x0004013000002202
#qtm: 0x0004013020004202
ro: 0x0004013000003702
socket: 0x0004013000002e02
spi: 0x0004013000002302
ssl: 0x0004013000002f02
mvd: 0x0004013020004102

I'm also getting a black icon - any idea why that happens? It shows up fine in FBI when I install the CIA - yet it's just completely black in the homemenu.
 

Attachments

  • crash_dump_00000000.dmp.zip
    505 bytes · Views: 102
Last edited by devleon,

devleon

Active Member
OP
Newcomer
Joined
Aug 17, 2016
Messages
32
Trophies
0
Age
28
XP
82
Country
Gambia, The
I was running the luma dev version - running the normal version doesn't crash the homebrew anymore - however now the call to mvdstdProcessVideoFrame returns 0xC920181A... Which apparently means "The session was closed by the other process."... For some reason, remaining_size is also 0 from the output produced here.
 
Last edited by devleon,

devleon

Active Member
OP
Newcomer
Joined
Aug 17, 2016
Messages
32
Trophies
0
Age
28
XP
82
Country
Gambia, The
So i've gotten as far as to build a CIA with the necessary mvd stuff and getting a successfull mvd init - and while mvd_colorconvert works just fine now - I'm having issues with mvd_video, in particular mvdstdProcessVideoFrame() returning 0xC920181A. It seems that I'm somehow crashing the mvd module.

I've added some debug statements, and I can tell mvdstdProcessVideoFrame doesn't get called up until video_pos is counted up to 0x1e - and at video_pos being 0x1e (and nalcount is 0x01, cur_nalunit_pos is 0x1c and prev_nalunit_pos is 0x00) mvdstdProcessVideoFrame get's called and returns with a 0xc920181a. (which means "The session was closed by the other process." according to 3dsbrew).

Full message is: "mvdstdProcessVideoFrame() at NAL-unit offset 0x00000000 size 0x0000001b returned: 0xc920181a. remaining_size=0x00000000".

Running either color-format-conversion or video after this just freezes the 3DS.

I tried Luma3ds non-dev and dev version, as well as Corbenik with svc patches enabled.
 
Last edited by devleon,

devleon

Active Member
OP
Newcomer
Joined
Aug 17, 2016
Messages
32
Trophies
0
Age
28
XP
82
Country
Gambia, The
I really hope this releases soon as a Pre-Release! Please do so! I would love to play my Steam Games on my 3DS!

SoonTM (as soon as I get the mvd service to work reliably)

I'd appreciate if a couple people could try go get the mvd sample running on their system and report back with results.

 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • Psionic Roshambo @ Psionic Roshambo:
    I had a girlfriend who had a twin sister and they would mess with me constantly.... Until one chipped a tooth then finally I could tell them apart.... Lol
  • Psionic Roshambo @ Psionic Roshambo:
    They would have the same hair style the same clothes everything... Really messed with my head lol
  • Psionic Roshambo @ Psionic Roshambo:
    @The Real Jdbye, I could see AMD trying to pull off the CPU GPU tandem thing, would be a way to maybe close the gap a bit with Nvidia. Plus it would kinda put Nvidia at a future disadvantage since Nvidia can't make X86/64 CPUs? Intel and AMD licensing issues... I wonder how much that has held back innovation.
  • The Real Jdbye @ The Real Jdbye:
    i don't think nvidia wants to get in the x64 cpu market anyways
  • The Real Jdbye @ The Real Jdbye:
    you've seen how much intel is struggling getting into the gpu market
  • The Real Jdbye @ The Real Jdbye:
    and nvidia is already doing ARM
  • The Real Jdbye @ The Real Jdbye:
    i don't think they want to take more focus away from their gpus
  • Psionic Roshambo @ Psionic Roshambo:
    Yeah I think Nvidia s future lays in AI GPU acceleration stuff if they can get that going it's going to be super interesting in the long term
  • Psionic Roshambo @ Psionic Roshambo:
    AI assisted game creation might become a thing
  • Psionic Roshambo @ Psionic Roshambo:
    At least that's something I think would be pretty cool.
  • Psionic Roshambo @ Psionic Roshambo:
    Don some VR glasses and gloves and talk to the computer and paint entire worlds
  • Psionic Roshambo @ Psionic Roshambo:
    "OK Cortana I want that mountain a little taller and more snow on top, and I would like some random ancient pine forest around the bottom"
  • Psionic Roshambo @ Psionic Roshambo:
    "Now we need a spring fed river flowing down the north side and add some wild life appropriate for the biome"
  • Psionic Roshambo @ Psionic Roshambo:
    Many TBs of assets and the programming of something like that is going to be tough but I think it's something we might see in 20 years maybe sooner
  • The Real Jdbye @ The Real Jdbye:
    @Psionic Roshambo AI assisted game creation is kinda already here, there was recently that AI that can turn any 2D image into a fully modeled 3D object, it's not perfect, but it's a starting point, beats starting from zero
    +1
  • The Real Jdbye @ The Real Jdbye:
    before that there was one to generate a fully modeled scene from a 2D image
    +1
  • The Real Jdbye @ The Real Jdbye:
    but most recently, there was one that actually generates a working unity scene with terrain and textures already set up that you can import right into unity, that's a huge time saver right there
    +1
  • The Real Jdbye @ The Real Jdbye:
    and using LLMs to generate NPC dialogue and even dynamically generated quests is something i'm sure is already happening
    +1
  • The Real Jdbye @ The Real Jdbye:
    will just take some time for games made using those things to be completed and released
    +1
  • K3Nv2 @ K3Nv2:
    @The Real Jdbye, it's bed bath and beyond you nitwit
  • The Real Jdbye @ The Real Jdbye:
    @K3Nv2 you said instructions with pictures, same difference
  • Psionic Roshambo @ Psionic Roshambo:
    Lol now with 32GBs of VRAM Ken?
    Psionic Roshambo @ Psionic Roshambo: Lol now with 32GBs of VRAM Ken?