{"action":"opened","issue":{"url":"https://api.github.com/repos/citra-emu/citra/issues/1212","labels_url":"https://api.github.com/repos/citra-emu/citra/issues/1212/labels{/name}","comments_url":"https://api.github.com/repos/citra-emu/citra/issues/1212/comments","events_url":"https://api.github.com/repos/citra-emu/citra/issues/1212/events","html_url":"https://github.com/citra-emu/citra/issues/1212","id":112671792,"number":1212,"title":"ncch.c guesses segment offsets instead of taking the given values","user":{"login":"neobrain","id":4840017,"avatar_url":"https://avatars.githubusercontent.com/u/4840017?v=3","gravatar_id":"","url":"https://api.github.com/users/neobrain","html_url":"https://github.com/neobrain","followers_url":"https://api.github.com/users/neobrain/followers","following_url":"https://api.github.com/users/neobrain/following{/other_user}","gists_url":"https://api.github.com/users/neobrain/gists{/gist_id}","starred_url":"https://api.github.com/users/neobrain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neobrain/subscriptions","organizations_url":"https://api.github.com/users/neobrain/orgs","repos_url":"https://api.github.com/users/neobrain/repos","events_url":"https://api.github.com/users/neobrain/events{/privacy}","received_events_url":"https://api.github.com/users/neobrain/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-21T20:24:30Z","updated_at":"2015-10-21T20:24:30Z","closed_at":null,"body":"NCCH headers already explicitly give the RAM offset to the code/ro/data sections. Citra for some reason calculates them manually, e.g. via\r\n```\r\n        codeset->rodata.offset = codeset->code.offset + codeset->code.size;\r\n```\r\nOther than being redundant code, this is not even guaranteed to match the offsets specified in the NCCH. In fact, our method of computing the data section size,\r\n```\r\n        codeset->data.size = exheader_header.codeset_info.data.num_max_pages * Memory::PAGE_SIZE + bss_page_size;\r\n```\r\nis AFAIK incorrect, because BSS is a part of data and already considered in `codeset_info.data.num_max_pages`."}}