From e492a253d9ae8cd07cc414873372cad5c198eb4f Mon Sep 17 00:00:00 2001
From: Thomas Edvalson <machin3@gmail.com>
Date: Fri, 25 Apr 2014 12:32:13 -0400
Subject: [PATCH 01/11] Added Travis CI script

---
 .travis.yml | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 .travis.yml

diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000000..9c6c6e0169
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,16 @@
+language: cpp
+compiler:
+ - gcc
+before_install:
+ - sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu/ trusty main universe"
+ - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
+ - sudo apt-get -qq update
+ - sudo apt-get -qq install libgtest-dev g++-4.8 xorg-dev libglu1-mesa-dev
+ - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 90
+ - git clone https://github.com/glfw/glfw.git
+ - "cd glfw && mkdir build && cd build && cmake .. && make && sudo make install ; cd -"
+ - "cd /usr/src/gtest && sudo cmake . && sudo cmake --build . && sudo mv libg* /usr/local/lib/ ; cd -"
+script:
+ - mkdir build && cd build
+ - cmake ..
+ - make -j4
\ No newline at end of file

From 5c768453630d873489a514728c73a4c49c2295a7 Mon Sep 17 00:00:00 2001
From: Thomas Edvalson <machin3@gmail.com>
Date: Fri, 25 Apr 2014 12:39:49 -0400
Subject: [PATCH 02/11] Remove potentially unnecessary lines in Travis script.

---
 .travis.yml | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 9c6c6e0169..51c19a2889 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,8 +2,6 @@ language: cpp
 compiler:
  - gcc
 before_install:
- - sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu/ trusty main universe"
- - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
  - sudo apt-get -qq update
  - sudo apt-get -qq install libgtest-dev g++-4.8 xorg-dev libglu1-mesa-dev
  - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 90
@@ -11,6 +9,5 @@ before_install:
  - "cd glfw && mkdir build && cd build && cmake .. && make && sudo make install ; cd -"
  - "cd /usr/src/gtest && sudo cmake . && sudo cmake --build . && sudo mv libg* /usr/local/lib/ ; cd -"
 script:
- - mkdir build && cd build
- - cmake ..
+ - cmake .
  - make -j4
\ No newline at end of file

From ac4947bb68899853f3e5bb75218d56e057476cc4 Mon Sep 17 00:00:00 2001
From: Thomas Edvalson <machin3@gmail.com>
Date: Fri, 25 Apr 2014 12:43:11 -0400
Subject: [PATCH 03/11] One of the lines wasn't quite unneccesary.

---
 .travis.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.travis.yml b/.travis.yml
index 51c19a2889..6ef2477c07 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,6 +2,7 @@ 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 libgtest-dev g++-4.8 xorg-dev libglu1-mesa-dev
  - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 90

From 322efe83faf2d37fc4e73c6193d54ed2c7da0cf2 Mon Sep 17 00:00:00 2001
From: Thomas Edvalson <machin3@gmail.com>
Date: Fri, 25 Apr 2014 12:52:01 -0400
Subject: [PATCH 04/11] Fixed travis dir problem (third time's the charm)

---
 .travis.yml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 6ef2477c07..db3554e19a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,11 +4,11 @@ compiler:
 before_install:
  - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
  - sudo apt-get -qq update
- - sudo apt-get -qq install libgtest-dev g++-4.8 xorg-dev libglu1-mesa-dev
+ - sudo apt-get -qq install g++-4.8 xorg-dev libglu1-mesa-dev
  - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 90
  - git clone https://github.com/glfw/glfw.git
- - "cd glfw && mkdir build && cd build && cmake .. && make && sudo make install ; cd -"
- - "cd /usr/src/gtest && sudo cmake . && sudo cmake --build . && sudo mv libg* /usr/local/lib/ ; cd -"
+ - "mkdir glfw/build && cd glfw/build && cmake .. && make && sudo make install ; cd -"
 script:
- - cmake .
+ - mkdir build && cd build
+ - cmake ..
  - make -j4
\ No newline at end of file

From c08cec14e1ac55d9336a5574e8fe1e3176235b34 Mon Sep 17 00:00:00 2001
From: Thomas Edvalson <machin3@gmail.com>
Date: Fri, 25 Apr 2014 21:54:09 -0400
Subject: [PATCH 05/11] Maybe needs libglew-dev?

---
 .travis.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.travis.yml b/.travis.yml
index db3554e19a..1a6874b544 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,7 +4,7 @@ compiler:
 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
+ - sudo apt-get -qq install g++-4.8 xorg-dev libglu1-mesa-dev libglew-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 -"

From 149503d249c1dee4d05c740d23b535f1139a902c Mon Sep 17 00:00:00 2001
From: Thomas Edvalson <machin3@gmail.com>
Date: Fri, 25 Apr 2014 22:04:18 -0400
Subject: [PATCH 06/11] Yet anothing missing dependency? libxcursor-dev

---
 .travis.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.travis.yml b/.travis.yml
index 1a6874b544..8bad122b26 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,7 +4,7 @@ compiler:
 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
+ - 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 -"

From a226dc57bf7ec7d3c6b32f2ec489fdca313732d5 Mon Sep 17 00:00:00 2001
From: Thomas Edvalson <machin3@gmail.com>
Date: Fri, 25 Apr 2014 23:01:58 -0400
Subject: [PATCH 07/11] Need to add Xcursor to linker?

---
 src/citra/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/citra/CMakeLists.txt b/src/citra/CMakeLists.txt
index 0023da2bf4..147f51e943 100644
--- a/src/citra/CMakeLists.txt
+++ b/src/citra/CMakeLists.txt
@@ -7,6 +7,6 @@ if (NOT X11_xf86vmode_LIB)
 endif()
 
 add_executable(citra ${SRCS})
-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})

From af921daa4c4bb9c02b53dfcaa35e3f4158b6bf21 Mon Sep 17 00:00:00 2001
From: bunnei <ericbunnie@gmail.com>
Date: Sun, 27 Apr 2014 22:32:51 -0400
Subject: [PATCH 08/11] added virtual address conversion for firmware FW0B

---
 src/core/mem_map.h         |  2 ++
 src/core/mem_map_funcs.cpp | 14 +++++++++-----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/core/mem_map.h b/src/core/mem_map.h
index c744e377e9..509fc8fd91 100644
--- a/src/core/mem_map.h
+++ b/src/core/mem_map.h
@@ -47,6 +47,8 @@ enum {
     FCRAM_PADDR_END         = (FCRAM_PADDR + FCRAM_SIZE),       ///< FCRAM end of physical space
     FCRAM_VADDR             = 0x08000000,                       ///< FCRAM virtual address
     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_VADDR       = 0x1EC00000,                       ///< IO virtual address start
diff --git a/src/core/mem_map_funcs.cpp b/src/core/mem_map_funcs.cpp
index c8daf0df5f..c057a81140 100644
--- a/src/core/mem_map_funcs.cpp
+++ b/src/core/mem_map_funcs.cpp
@@ -16,14 +16,18 @@ std::map<u32, MemoryBlock> g_heap_map;
 std::map<u32, MemoryBlock> g_heap_gsp_map;
 std::map<u32, MemoryBlock> g_shared_map;
 
-/// Convert a physical address to virtual address
-u32 _AddressPhysicalToVirtual(const u32 addr) {
+/// Convert a physical address (or firmware-specific virtual address) to primary virtual address
+u32 _VirtualAddress(const u32 addr) {
     // 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 
     // any MMU emulation yet or anything
     if ((addr >= FCRAM_PADDR) && (addr < FCRAM_PADDR_END)) {
         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
     // TODO(bunnei): FixMe
     // 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.
     // 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
     // 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>
 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
     // 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) {
-    const u32 vaddr = _AddressPhysicalToVirtual(addr);
+    const u32 vaddr = _VirtualAddress(addr);
 
     // FCRAM - GSP heap
     if ((vaddr >= HEAP_GSP_VADDR)  && (vaddr < HEAP_GSP_VADDR_END)) {

From b7eb9aad3ec600ea077628ecff998c14222c2e54 Mon Sep 17 00:00:00 2001
From: bunnei <bunneidev@gmail.com>
Date: Mon, 28 Apr 2014 12:21:41 -0400
Subject: [PATCH 09/11] added Travis CI build indicator to README.md

---
 README.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/README.md b/README.md
index 8621752010..ab3540d013 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,7 @@
 citra emulator
 ==============
+![Travis CI Build Status](https://travis-ci.org/bunnei/citra.svg)
+
 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.
 
 For development discussion, please join us @ #citra on [freenode](http://webchat.freenode.net/).

From 305c2e61bd76b9f7ac65f52c133c76b34975aa5d Mon Sep 17 00:00:00 2001
From: bunnei <bunneidev@gmail.com>
Date: Mon, 28 Apr 2014 12:23:38 -0400
Subject: [PATCH 10/11] fixed build image in README.md to link to Travis CI
 page

---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index ab3540d013..9fbb7af8a1 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
 citra emulator
 ==============
-![Travis CI Build Status](https://travis-ci.org/bunnei/citra.svg)
+[![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.
 

From 5a3d9b8e6183ad92fa1bd19b5fe981bab131d3b5 Mon Sep 17 00:00:00 2001
From: bunnei <bunneidev@gmail.com>
Date: Mon, 28 Apr 2014 17:07:48 -0400
Subject: [PATCH 11/11] added FAQ link to README.md

---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 9fbb7af8a1..832b647bd5 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@ citra emulator
 ==============
 [![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.
+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/).