mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-15 10:40:01 +01:00
Minor fixes. Use OutputDebugString for native logging on Windows.
This commit is contained in:
1 parent
fdb1ad3f0e
commit
2143b5b608
8 files changed
+45
-24
No files matched your search
@@ -11,6 +11,7 @@
|
||||
|
||||
#undef Crash
|
||||
|
||||
#include <stdio.h>
|
||||
// Logging
|
||||
#ifdef _WIN32
|
||||
|
||||
@@ -61,7 +62,17 @@ inline void Crash() {
|
||||
|
||||
#else
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
void __ods__(const char *p);
|
||||
|
||||
#define ILOG(...) {char temp[512]; char *p = temp; p += sprintf(p, "I: %s:%i: ", __FILE__, __LINE__); p += sprintf(p, "I: " __VA_ARGS__); p += sprintf(p, "\n"); __ods__(temp);}
|
||||
#define WLOG(...) {char temp[512]; char *p = temp; p += sprintf(p, "W: %s:%i: ", __FILE__, __LINE__); p += sprintf(p, "W: " __VA_ARGS__); p += sprintf(p, "\n"); __ods__(temp);}
|
||||
#define ELOG(...) {char temp[512]; char *p = temp; p += sprintf(p, "E: %s:%i: ", __FILE__, __LINE__); p += sprintf(p, "E: " __VA_ARGS__); p += sprintf(p, "\n"); __ods__(temp);}
|
||||
#define FLOG(...) {char temp[512]; char *p = temp; p += sprintf(p, "F: %s:%i: ", __FILE__, __LINE__); p += sprintf(p, "F: " __VA_ARGS__); p += sprintf(p, "\n"); __ods__(temp); Crash();}
|
||||
|
||||
// TODO: Win32 version using OutputDebugString
|
||||
#else
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -70,6 +81,7 @@ inline void Crash() {
|
||||
#define ELOG(...) {printf("E: %s:%i: ", __FILE__, __LINE__); printf("E: " __VA_ARGS__); printf("\n");}
|
||||
#define FLOG(...) {printf("F: %s:%i: ", __FILE__, __LINE__); printf("F: " __VA_ARGS__); printf("\n"); Crash();}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#undef CHECK
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <windows.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
@@ -15,6 +16,10 @@
|
||||
#define strcasecmp _stricmp
|
||||
#endif
|
||||
|
||||
void __ods__(const char *p) {
|
||||
OutputDebugString(p);
|
||||
}
|
||||
|
||||
unsigned int parseHex(const char *_szValue)
|
||||
{
|
||||
int Value = 0;
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ struct Point {
|
||||
|
||||
// Resolved bounds on screen after layout.
|
||||
struct Bounds {
|
||||
Bounds() {}
|
||||
Bounds() : x(0), y(0), w(0), h(0) {}
|
||||
Bounds(float x_, float y_, float w_, float h_) : x(x_), y(y_), w(w_), h(h_) {}
|
||||
|
||||
bool Contains(float px, float py) const {
|
||||
|
||||
+9
-8
@@ -46,19 +46,22 @@ void ScreenManager::switchToNext() {
|
||||
}
|
||||
Layer newLayer = {nextScreen_, 0};
|
||||
stack_.push_back(newLayer);
|
||||
delete temp.screen;
|
||||
if (temp.screen) {
|
||||
ELOG("Deleting screen");
|
||||
delete temp.screen;
|
||||
}
|
||||
nextScreen_ = 0;
|
||||
}
|
||||
|
||||
void ScreenManager::touch(const TouchInput &touch) {
|
||||
if (stack_.size()) {
|
||||
if (!stack_.empty()) {
|
||||
stack_.back().screen->touch(touch);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenManager::render() {
|
||||
if (stack_.size()) {
|
||||
if (!stack_.empty()) {
|
||||
switch (stack_.back().flags) {
|
||||
case LAYER_SIDEMENU:
|
||||
if (stack_.size() == 1) {
|
||||
@@ -88,20 +91,20 @@ void ScreenManager::render() {
|
||||
}
|
||||
|
||||
void ScreenManager::sendMessage(const char *msg, const char *value) {
|
||||
if (stack_.size())
|
||||
if (!stack_.empty())
|
||||
stack_.back().screen->sendMessage(msg, value);
|
||||
}
|
||||
|
||||
void ScreenManager::deviceLost()
|
||||
{
|
||||
if (stack_.size())
|
||||
if (!stack_.empty())
|
||||
stack_.back().screen->deviceLost();
|
||||
// Dialogs too? Nah, they should only use the standard UI texture anyway.
|
||||
// TODO: Change this when it becomes necessary.
|
||||
}
|
||||
|
||||
Screen *ScreenManager::topScreen() {
|
||||
if (stack_.size())
|
||||
if (!stack_.empty())
|
||||
return stack_.back().screen;
|
||||
else
|
||||
return 0;
|
||||
@@ -109,9 +112,7 @@ Screen *ScreenManager::topScreen() {
|
||||
|
||||
void ScreenManager::shutdown() {
|
||||
for (auto x = stack_.begin(); x != stack_.end(); x++)
|
||||
{
|
||||
delete x->screen;
|
||||
}
|
||||
stack_.clear();
|
||||
delete nextScreen_;
|
||||
nextScreen_ = 0;
|
||||
|
||||
+7
-5
@@ -13,9 +13,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/display.h"
|
||||
#include "base/NativeApp.h"
|
||||
|
||||
@@ -33,8 +34,10 @@ class UIContext;
|
||||
|
||||
class Screen {
|
||||
public:
|
||||
Screen(bool isUiScreen = false) : screenManager_(0), isUiScreen_(isUiScreen) { }
|
||||
virtual ~Screen() {}
|
||||
Screen() : screenManager_(0) { }
|
||||
virtual ~Screen() {
|
||||
screenManager_ = 0;
|
||||
}
|
||||
|
||||
virtual void update(InputState &input) = 0;
|
||||
virtual void render() {}
|
||||
@@ -50,7 +53,6 @@ public:
|
||||
|
||||
private:
|
||||
ScreenManager *screenManager_;
|
||||
bool isUiScreen_;
|
||||
DISALLOW_COPY_AND_ASSIGN(Screen);
|
||||
};
|
||||
|
||||
@@ -110,5 +112,5 @@ private:
|
||||
|
||||
// Dialog stack. These are shown "on top" of base screens and the Android back button works as expected.
|
||||
// Used for options, in-game menus and other things you expect to be able to back out from onto something.
|
||||
std::list<Layer> stack_;
|
||||
std::vector<Layer> stack_;
|
||||
};
|
||||
+2
-5
@@ -4,19 +4,16 @@
|
||||
#include "ui/screen.h"
|
||||
|
||||
UIScreen::UIScreen()
|
||||
: Screen(), root_(0), recreateViews_(false) {
|
||||
: Screen(), root_(0), recreateViews_(true) {
|
||||
|
||||
}
|
||||
|
||||
void UIScreen::update(InputState &input) {
|
||||
if (!root_) {
|
||||
CreateViews();
|
||||
}
|
||||
|
||||
if (recreateViews_) {
|
||||
delete root_;
|
||||
root_ = 0;
|
||||
CreateViews();
|
||||
recreateViews_ = false;
|
||||
}
|
||||
|
||||
UpdateViewHierarchy(input, root_);
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <cmath>
|
||||
#include <cstdio>
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/functional.h"
|
||||
#include "base/mutex.h"
|
||||
#include "base/basictypes.h"
|
||||
@@ -227,7 +228,7 @@ View *GetFocusedView();
|
||||
|
||||
class View {
|
||||
public:
|
||||
View(LayoutParams *layoutParams = 0) : layoutParams_(layoutParams), enabled_(true), visibility_(V_VISIBLE) {
|
||||
View(LayoutParams *layoutParams = 0) : layoutParams_(layoutParams), enabled_(true), visibility_(V_VISIBLE), measuredWidth_(0), measuredHeight_(0) {
|
||||
if (!layoutParams)
|
||||
layoutParams_.reset(new LayoutParams());
|
||||
}
|
||||
|
||||
+7
-4
@@ -28,8 +28,11 @@ void ApplyGravity(const Bounds outer, const Margins &margins, float w, float h,
|
||||
|
||||
ViewGroup::~ViewGroup() {
|
||||
// Tear down the contents recursively.
|
||||
for (auto iter = views_.begin(); iter != views_.end(); ++iter)
|
||||
delete *iter;
|
||||
for (size_t i = 0; i < views_.size(); i++) {
|
||||
delete views_[i];
|
||||
views_[i] = 0;
|
||||
}
|
||||
views_.clear();
|
||||
}
|
||||
|
||||
void ViewGroup::Touch(const TouchInput &input) {
|
||||
@@ -530,12 +533,12 @@ void AnchorLayout::Measure(const UIContext &dc, MeasureSpec horiz, MeasureSpec v
|
||||
|
||||
if (params->left >= 0 && params->right >= 0) {
|
||||
width = measuredWidth_ - params->left - params->right;
|
||||
specW = MeasureSpec(EXACTLY, width);
|
||||
}
|
||||
if (params->top >= 0 && params->bottom >= 0) {
|
||||
height = measuredHeight_ - params->top - params->bottom;
|
||||
specH = MeasureSpec(EXACTLY, height);
|
||||
}
|
||||
specW = MeasureSpec(EXACTLY, width);
|
||||
specH = MeasureSpec(EXACTLY, height);
|
||||
}
|
||||
|
||||
views_[i]->Measure(dc, specW, specH);
|
||||
|
||||
Reference in new issue
Block a user