Permalink
Browse files

Fix arrays of nullable types.

Handle WMA compression quality setting in XACT projects.
Fix GameComponents not being initialized if added to the components collection after the game is initialized.
Copy effects to the output folder as raw XNBs so we can load them.
Stub out an effect loader.
  • Loading branch information...
1 parent 85254fa commit 8cbff9258034e1bc43f63e9bfc431b36deaa81b3 @kg kg committed Apr 12, 2012
View
@@ -37,6 +37,7 @@ Tests/*Cases/*.js
/Examples/obj
/jsil.org/demos/RPG/Content
/jsil.org/demos/Sully/Content
+/jsil.org/demos/Lumberjack
/Upstream/dxtc.cpp
/Upstream/LAME
/Upstream/FFMPEG
@@ -792,13 +792,15 @@ public struct CompressResult {
case "FontDescriptionProcessor":
copyRawXnb(item, xnbPath, "SpriteFont");
continue;
+
case "SoundEffectProcessor":
case "SongProcessor":
journal.AddRange(CompressAudioGroup(
item.EvaluatedInclude, contentProjectDirectory, itemOutputDirectory,
configuration.ProfileSettings, existingJournal, logOutput
));
continue;
+
case "TextureProcessor":
if (Path.GetExtension(sourcePath).ToLower() == ".tga") {
copyRawXnb(item, xnbPath, "Texture2D");
@@ -816,6 +818,10 @@ public struct CompressResult {
}
continue;
+
+ case "EffectProcessor":
+ copyRawXnb(item, xnbPath, "XNB");
+ continue;
}
switch (importerName) {
@@ -59,9 +59,7 @@ public class ReplaceMethodCalls : JSAstVisitor {
}
}
} else if (
- (type != null) &&
- (type.Type.FullName.StartsWith("System.Nullable")) &&
- (type.Type is GenericInstanceType)
+ IsNullable(type.Type)
) {
var t = (type.Type as GenericInstanceType).GenericArguments[0];
var @null = JSLiteral.Null(t);
@@ -276,10 +274,16 @@ public class ReplaceMethodCalls : JSAstVisitor {
VisitChildren(ie);
}
+ protected bool IsNullable (TypeReference type) {
+ var git = type as GenericInstanceType;
+
+ return (git != null) && (git.Name == "Nullable`1");
+ }
+
public void VisitNode (JSPropertyAccess pa) {
var targetType = pa.Target.GetExpectedType(TypeSystem);
- if (targetType.FullName.StartsWith("System.Nullable")) {
+ if (IsNullable(targetType)) {
var @null = JSLiteral.Null(targetType);
switch (pa.Property.Property.Member.Name) {
@@ -308,9 +312,9 @@ public class ReplaceMethodCalls : JSAstVisitor {
public void VisitNode (JSDefaultValueLiteral dvl) {
var expectedType = dvl.GetExpectedType(TypeSystem);
+
if (
- (expectedType != null) &&
- expectedType.FullName.StartsWith("System.Nullable")
+ IsNullable(expectedType)
) {
ParentNode.ReplaceChild(
dvl, JSLiteral.Null(expectedType)
@@ -323,8 +327,7 @@ public class ReplaceMethodCalls : JSAstVisitor {
public void VisitNode (JSNewExpression ne) {
var expectedType = ne.GetExpectedType(TypeSystem);
if (
- (expectedType != null) &&
- expectedType.FullName.StartsWith("System.Nullable")
+ IsNullable(expectedType)
) {
if (ne.Arguments.Count == 0) {
ParentNode.ReplaceChild(
@@ -855,6 +855,10 @@ $jsilcore.$ListExternals = function ($, T, type) {
this._items[this._size] = item;
}
this._size += 1;
+
+ if (typeof (this.$OnItemAdded) === "function")
+ this.$OnItemAdded(item);
+
return this._size;
};
@@ -3255,3 +3259,47 @@ JSIL.ImplementExternals("System.Text.RegularExpressions.Match", function ($) {
this._length = text.length;
});
});
+
+JSIL.ImplementExternals("System.Resources.ResourceManager", function ($) {
+
+ $.Method({Static:false, Public:false}, ".ctor",
+ (new JSIL.MethodSignature(null, [], [])),
+ function _ctor () {
+ // FIXME
+ }
+ );
+
+ $.Method({Static:false, Public:false}, ".ctor",
+ (new JSIL.MethodSignature(null, [
+ $.String, $.String,
+ $asms[5].TypeRef("System.Type")
+ ], [])),
+ function _ctor (baseName, resourceDir, usingResourceSet) {
+ // FIXME
+ }
+ );
+
+ $.Method({Static:false, Public:true }, ".ctor",
+ (new JSIL.MethodSignature(null, [$.String, $asms[5].TypeRef("System.Reflection.Assembly")], [])),
+ function _ctor (baseName, assembly) {
+ // FIXME
+ }
+ );
+
+ $.Method({Static:false, Public:true }, "GetString",
+ (new JSIL.MethodSignature($.String, [$.String], [])),
+ function GetString (name) {
+ // FIXME
+ return name;
+ }
+ );
+
+ $.Method({Static:false, Public:true }, "GetString",
+ (new JSIL.MethodSignature($.String, [$.String, $asms[5].TypeRef("System.Globalization.CultureInfo")], [])),
+ function GetString (name, culture) {
+ // FIXME
+ return name;
+ }
+ );
+
+});
View
@@ -3854,85 +3854,91 @@ JSIL.OverloadedMethodCore = function (type, name, overloads, dispatcher) {
);
};
-JSIL.ImplementExternals(
- "System.Object", function ($) {
- $.RawMethod(true, "CheckType",
- function (value) {
- return (typeof (value) === "object");
- }
- );
+JSIL.ImplementExternals("System.Object", function ($) {
+ $.RawMethod(true, "CheckType",
+ function (value) {
+ return (typeof (value) === "object");
+ }
+ );
- $.RawMethod(false, "__Initialize__",
- function (initializer) {
- var isInitializer = function (v) {
- return (typeof (v) === "object") && (v !== null) &&
- (Object.getPrototypeOf(v) === JSIL.CollectionInitializer.prototype);
- };
+ $.RawMethod(false, "__Initialize__",
+ function (initializer) {
+ var isInitializer = function (v) {
+ return (typeof (v) === "object") && (v !== null) &&
+ (Object.getPrototypeOf(v) === JSIL.CollectionInitializer.prototype);
+ };
- if (JSIL.IsArray(initializer)) {
- JSIL.ApplyCollectionInitializer(this, initializer);
- return this;
- } else if (isInitializer(initializer)) {
- initializer.Apply(this);
- return this;
- }
+ if (JSIL.IsArray(initializer)) {
+ JSIL.ApplyCollectionInitializer(this, initializer);
+ return this;
+ } else if (isInitializer(initializer)) {
+ initializer.Apply(this);
+ return this;
+ }
- for (var key in initializer) {
- if (!initializer.hasOwnProperty(key))
- continue;
+ for (var key in initializer) {
+ if (!initializer.hasOwnProperty(key))
+ continue;
- var value = initializer[key];
+ var value = initializer[key];
- if (isInitializer(value)) {
- value.Apply(this[key]);
- } else {
- this[key] = value;
- }
+ if (isInitializer(value)) {
+ value.Apply(this[key]);
+ } else {
+ this[key] = value;
}
-
- return this;
}
- );
+ return this;
+ }
+ );
- $.Method({Static: false, Public: true}, "GetType",
- new JSIL.MethodSignature("System.Type", [], [], $jsilcore),
- function () {
- return this.__ThisType__;
- }
- );
- $.Method({Static: false, Public: true}, "Equals",
- new JSIL.MethodSignature("System.Boolean", ["System.Object"], [], $jsilcore),
- function (rhs) {
- return this === rhs;
- }
- );
+ $.Method({Static: false, Public: true}, "GetType",
+ new JSIL.MethodSignature("System.Type", [], [], $jsilcore),
+ function () {
+ return this.__ThisType__;
+ }
+ );
- $.Method({Static: false, Public: false}, "MemberwiseClone",
- new JSIL.MethodSignature("System.Object", [], [], $jsilcore),
- function () {
- var result = Object.create(Object.getPrototypeOf(this));
+ $.Method({Static: false, Public: true}, "Equals",
+ new JSIL.MethodSignature("System.Boolean", ["System.Object"], [], $jsilcore),
+ function (rhs) {
+ return this === rhs;
+ }
+ );
- JSIL.CopyMembers(this, result);
- return result;
- }
- );
+ $.Method({Static: false, Public: false}, "MemberwiseClone",
+ new JSIL.MethodSignature("System.Object", [], [], $jsilcore),
+ function () {
+ var result = Object.create(Object.getPrototypeOf(this));
- $.Method({Static: false, Public: true}, ".ctor",
- new JSIL.MethodSignature(null, []),
- function () {
- }
- );
+ JSIL.CopyMembers(this, result);
+ return result;
+ }
+ );
- $.Method({Static: false, Public: true}, "toString",
- new JSIL.MethodSignature("System.String", [], [], $jsilcore),
- function () {
- return JSIL.GetTypeName(this);
- }
- );
- }
-);
+ $.Method({Static: false, Public: true}, ".ctor",
+ new JSIL.MethodSignature(null, []),
+ function () {
+ }
+ );
+
+ $.Method({Static: false, Public: true}, "toString",
+ new JSIL.MethodSignature("System.String", [], [], $jsilcore),
+ function () {
+ return JSIL.GetTypeName(this);
+ }
+ );
+
+ $.Method({Static:true , Public:true }, "ReferenceEquals",
+ (new JSIL.MethodSignature($.Boolean, [$.Object, $.Object], [])),
+ function ReferenceEquals (objA, objB) {
+ return objA === objB;
+ }
+ );
+
+});
JSIL.MakeClass(Object, "System.Object", true, [], function ($) {
$.ExternalMethod({Static: false, Public: true}, ".ctor",
Oops, something went wrong.

0 comments on commit 8cbff92

Please sign in to comment.