Merge commit upstream/master into issue-7-fix

This commit is contained in:
archshift 2014-04-28 19:44:43 -07:00
commit 237d079aad
5 changed files with 29 additions and 7 deletions

14
.travis.yml Normal file
View file

@ -0,0 +1,14 @@
language: cpp
compiler:
- gcc
before_install:
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
- sudo apt-get -qq update
- sudo apt-get -qq install g++-4.8 xorg-dev libglu1-mesa-dev libglew-dev libxcursor-dev
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 90
- git clone https://github.com/glfw/glfw.git
- "mkdir glfw/build && cd glfw/build && cmake .. && make && sudo make install ; cd -"
script:
- mkdir build && cd build
- cmake ..
- make -j4

View file

@ -1,6 +1,8 @@
citra emulator citra emulator
============== ==============
An experimental open-source Nintendo 3DS emulator/debugger written in C++. At this time, it only emulates a very small subset of 3DS hardware, and therefore is only useful for booting/debugging very simple homebrew demos. Citra is licensed under the GPLv2. Refer to the license.txt file included. [![Travis CI Build Status](https://travis-ci.org/bunnei/citra.svg)](https://travis-ci.org/bunnei/citra)
An experimental open-source Nintendo 3DS emulator/debugger written in C++. At this time, it only emulates a very small subset of 3DS hardware, and therefore is only useful for booting/debugging very simple homebrew demos. Citra is licensed under the GPLv2. Refer to the license.txt file included. Please read the [FAQ](https://github.com/bunnei/citra/wiki/FAQ) before getting started with the project.
For development discussion, please join us @ #citra on [freenode](http://webchat.freenode.net/). For development discussion, please join us @ #citra on [freenode](http://webchat.freenode.net/).

View file

@ -9,6 +9,6 @@ if (NOT X11_xf86vmode_LIB)
endif() endif()
add_executable(citra ${SRCS} ${HEADS}) add_executable(citra ${SRCS} ${HEADS})
target_link_libraries(citra core common video_core GLEW pthread X11 Xxf86vm Xi ${OPENGL_LIBRARIES} ${GLFW_LIBRARIES} rt ${X11_Xrandr_LIB} ${X11_xv86vmode_LIB}) target_link_libraries(citra core common video_core GLEW pthread X11 Xxf86vm Xi Xcursor ${OPENGL_LIBRARIES} ${GLFW_LIBRARIES} rt ${X11_Xrandr_LIB} ${X11_xv86vmode_LIB})
#install(TARGETS citra RUNTIME DESTINATION ${bindir}) #install(TARGETS citra RUNTIME DESTINATION ${bindir})

View file

@ -47,6 +47,8 @@ enum {
FCRAM_PADDR_END = (FCRAM_PADDR + FCRAM_SIZE), ///< FCRAM end of physical space FCRAM_PADDR_END = (FCRAM_PADDR + FCRAM_SIZE), ///< FCRAM end of physical space
FCRAM_VADDR = 0x08000000, ///< FCRAM virtual address FCRAM_VADDR = 0x08000000, ///< FCRAM virtual address
FCRAM_VADDR_END = (FCRAM_VADDR + FCRAM_SIZE), ///< FCRAM end of virtual space FCRAM_VADDR_END = (FCRAM_VADDR + FCRAM_SIZE), ///< FCRAM end of virtual space
FRAM_VADDR_FW0B = 0xF0000000, ///< FCRAM adress for firmare FW0B
FRAM_VADDR_FW0B_END = (FRAM_VADDR_FW0B + FCRAM_SIZE), ///< FCRAM adress end for FW0B
HARDWARE_IO_PADDR = 0x10000000, ///< IO physical address start HARDWARE_IO_PADDR = 0x10000000, ///< IO physical address start
HARDWARE_IO_VADDR = 0x1EC00000, ///< IO virtual address start HARDWARE_IO_VADDR = 0x1EC00000, ///< IO virtual address start

View file

@ -16,14 +16,18 @@ std::map<u32, MemoryBlock> g_heap_map;
std::map<u32, MemoryBlock> g_heap_gsp_map; std::map<u32, MemoryBlock> g_heap_gsp_map;
std::map<u32, MemoryBlock> g_shared_map; std::map<u32, MemoryBlock> g_shared_map;
/// Convert a physical address to virtual address /// Convert a physical address (or firmware-specific virtual address) to primary virtual address
u32 _AddressPhysicalToVirtual(const u32 addr) { u32 _VirtualAddress(const u32 addr) {
// Our memory interface read/write functions assume virtual addresses. Put any physical address // Our memory interface read/write functions assume virtual addresses. Put any physical address
// to virtual address translations here. This is obviously quite hacky... But we're not doing // to virtual address translations here. This is obviously quite hacky... But we're not doing
// any MMU emulation yet or anything // any MMU emulation yet or anything
if ((addr >= FCRAM_PADDR) && (addr < FCRAM_PADDR_END)) { if ((addr >= FCRAM_PADDR) && (addr < FCRAM_PADDR_END)) {
return VirtualAddressFromPhysical_FCRAM(addr); return VirtualAddressFromPhysical_FCRAM(addr);
// Virtual address mapping FW0B
} else if ((addr >= FRAM_VADDR_FW0B) && (addr < FRAM_VADDR_FW0B_END)) {
return VirtualAddressFromPhysical_FCRAM(addr);
// Hardware IO // Hardware IO
// TODO(bunnei): FixMe // TODO(bunnei): FixMe
// This isn't going to work... The physical address of HARDWARE_IO conflicts with the virtual // This isn't going to work... The physical address of HARDWARE_IO conflicts with the virtual
@ -41,7 +45,7 @@ inline void _Read(T &var, const u32 addr) {
// TODO: Make sure this represents the mirrors in a correct way. // TODO: Make sure this represents the mirrors in a correct way.
// Could just do a base-relative read, too.... TODO // Could just do a base-relative read, too.... TODO
const u32 vaddr = _AddressPhysicalToVirtual(addr); const u32 vaddr = _VirtualAddress(addr);
// Memory allocated for HLE use that can be addressed from the emulated application // Memory allocated for HLE use that can be addressed from the emulated application
// The primary use of this is sharing a commandbuffer between the HLE OS (syscore) and the LLE // The primary use of this is sharing a commandbuffer between the HLE OS (syscore) and the LLE
@ -77,7 +81,7 @@ inline void _Read(T &var, const u32 addr) {
template <typename T> template <typename T>
inline void _Write(u32 addr, const T data) { inline void _Write(u32 addr, const T data) {
u32 vaddr = _AddressPhysicalToVirtual(addr); u32 vaddr = _VirtualAddress(addr);
// Memory allocated for HLE use that can be addressed from the emulated application // Memory allocated for HLE use that can be addressed from the emulated application
// The primary use of this is sharing a commandbuffer between the HLE OS (syscore) and the LLE // The primary use of this is sharing a commandbuffer between the HLE OS (syscore) and the LLE
@ -121,7 +125,7 @@ inline void _Write(u32 addr, const T data) {
} }
u8 *GetPointer(const u32 addr) { u8 *GetPointer(const u32 addr) {
const u32 vaddr = _AddressPhysicalToVirtual(addr); const u32 vaddr = _VirtualAddress(addr);
// FCRAM - GSP heap // FCRAM - GSP heap
if ((vaddr >= HEAP_GSP_VADDR) && (vaddr < HEAP_GSP_VADDR_END)) { if ((vaddr >= HEAP_GSP_VADDR) && (vaddr < HEAP_GSP_VADDR_END)) {